Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

staging/usbip: fix store_attach() sscanf return value check

sscanf() parses the input buffer for four input items. However,
the return value check is incorrect, as it checks for one input
item instead of four which is what it is expecting in the input
buffer. As a result, sscanf() will always fail even when the input
buffer is correct.

Signed-off-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Shuah Khan and committed by
Greg Kroah-Hartman
de4734bc 21c5e840

+1 -1
+1 -1
drivers/staging/usbip/vhci_sysfs.c
··· 184 184 * @devid: unique device identifier in a remote host 185 185 * @speed: usb device speed in a remote host 186 186 */ 187 - if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1) 187 + if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 4) 188 188 return -EINVAL; 189 189 190 190 usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n",