mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 11:11:45 -04:00
usbip: tools: Fix read_usb_vudc_device() error path handling
This isn't really accurate right. fread() doesn't always return 0 in error. It could return < number of elements and set errno. Signed-off-by: GwanYeong Kim <[email protected]> Acked-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
d5501d5c29
commit
28df0642ab
1 changed files with 4 additions and 2 deletions
|
|
@ -69,7 +69,7 @@ int read_usb_vudc_device(struct udev_device *sdev, struct usbip_usb_device *dev)
|
|||
FILE *fd = NULL;
|
||||
struct udev_device *plat;
|
||||
const char *speed;
|
||||
int ret = 0;
|
||||
size_t ret;
|
||||
|
||||
plat = udev_device_get_parent(sdev);
|
||||
path = udev_device_get_syspath(plat);
|
||||
|
|
@ -79,8 +79,10 @@ 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 != 1) {
|
||||
err("Cannot read vudc device descr file: %s", strerror(errno));
|
||||
goto err;
|
||||
}
|
||||
fclose(fd);
|
||||
|
||||
copy_descr_attr(dev, &descr, bDeviceClass);
|
||||
|
|
|
|||
Loading…
Reference in a new issue