lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sun, 26 Nov 2017 16:18:51 +0000
From:   Gimcuan Hui <gimcuan@...il.com>
To:     Johan Hovold <johan@...nel.org>
Cc:     gregkh@...uxfoundation.org, linux-usb@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] USB: serial: Correct return value on read

It's meaningless to return buf[0] on read. Because the caller of this
interface checks the return value negative or not. Instead, we should
return the result variable.

Signed-off-by: Gimcuan Hui <gimcuan@...il.com>
---
 drivers/usb/serial/ark3116.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/serial/ark3116.c b/drivers/usb/serial/ark3116.c
index 3c544782f60b..bfdbc7164e7b 100644
--- a/drivers/usb/serial/ark3116.c
+++ b/drivers/usb/serial/ark3116.c
@@ -101,11 +101,9 @@ static int ark3116_read_reg(struct usb_serial *serial,
 				reg, result);
 		if (result >= 0)
 			result = -EIO;
-
-		return result;
 	}
 
-	return buf[0];
+	return result;
 }
 
 static inline int calc_divisor(int bps)
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ