linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbip: tools: Fix read_usb_vudc_device() error path handling
@ 2019-10-15 13:14 GwanYeong Kim
  2019-10-15 23:14 ` shuah
  0 siblings, 1 reply; 10+ messages in thread
From: GwanYeong Kim @ 2019-10-15 13:14 UTC (permalink / raw)
  To: valentina.manea.m
  Cc: shuah, gregkh, allison, opensource, changcheng.liu, tglx,
	linux-usb, GwanYeong Kim

cannot be less than 0 - fread() returns 0 on error.

Signed-off-by: GwanYeong Kim <gy741.kim@gmail.com>
---
 tools/usb/usbip/libsrc/usbip_device_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/usb/usbip/libsrc/usbip_device_driver.c b/tools/usb/usbip/libsrc/usbip_device_driver.c
index 051d7d3f443b..49760b98aabc 100644
--- a/tools/usb/usbip/libsrc/usbip_device_driver.c
+++ b/tools/usb/usbip/libsrc/usbip_device_driver.c
@@ -79,7 +79,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
 	if (!fd)
 		return -1;
 	ret = fread((char *) &descr, sizeof(descr), 1, fd);
-	if (ret < 0)
+	if (ret != sizeof(descr))
 		goto err;
 	fclose(fd);
 
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-10-21 19:00 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-15 13:14 [PATCH] usbip: tools: Fix read_usb_vudc_device() error path handling GwanYeong Kim
2019-10-15 23:14 ` shuah
2019-10-16  4:38   ` GwanYeong Kim
2019-10-16 13:18     ` Greg KH
2019-10-17  2:25       ` [PATCH v2] " GwanYeong Kim
2019-10-17  2:33         ` shuah
2019-10-17  5:26           ` GwanYeong Kim
2019-10-17 13:00             ` shuah
2019-10-18  3:22               ` [PATCH v3] " GwanYeong Kim
2019-10-21 18:59                 ` shuah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).