minor bug in usbip tool
Quoted 18 lines · Juan Zea
Hi,
I've being taking a deep look at the code in the usbip tool and found this small bug at https://github.com/torvalds/linux/blob/master/tools/usb/usbip/src/utils.c :
44 rc = write_sysfs_attribute(match_busid_attr_path, command,
45 sizeof(command)); ^Using sizeof instead of strlen in this line, leads to the following situation as seen by a strace:
strace -s100000/usr/local/sbin/usbipbind -b 1-1.3
.
.open("/sys/bus/usb/drivers/usbip-host/match_busid", O_WRONLY)= 3write(3, "add 1-1.3\0@\0\0\0\0\0unbind\0\0\0\0\0\0\0\0\0\0/sys", 36)= 36
close(3)
.
.
Quoted 3 lines
The string line should be "add 1-1.3" alone, but well, it works, so no doubt nobody noticed before.
Thought it is worth reporting anyway. Here's the patch:
Thanks for finding this and sending a patch.
But:
Quoted 7 lines
tools/usb/usbip/src/utils.c +0
-0
tools/usb/usbip/src/utils.c int modify_match_busid(char *busid, int add) · line 48
Quoted 8 lines
tools/usb/usbip/src/utils.c +1
-1@@ -42,7 +42,7 @@ int modify_match_busid(char *busid, int add)snprintf (command,SYSFS_BUS_ID_SIZE +4 ,"del %s" , busid); rc =write_sysfs_attribute (match_busid_attr_path, command, -sizeof (command)); +strlen (command));if (rc <0 ) {dbg ("failed to write match_busid: %s" ,strerror (errno));return -1 ;
Can you resend this in a format that we can apply it in? Please look at Documentation/SubmittingPatches for how to do this.
thanks,
greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html