Commit de4734bc authored by Shuah Khan's avatar Shuah Khan Committed by Greg Kroah-Hartman

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: default avatarShuah Khan <shuah.kh@samsung.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 21c5e840
...@@ -184,7 +184,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, ...@@ -184,7 +184,7 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr,
* @devid: unique device identifier in a remote host * @devid: unique device identifier in a remote host
* @speed: usb device speed in a remote host * @speed: usb device speed in a remote host
*/ */
if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1) if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 4)
return -EINVAL; return -EINVAL;
usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n", usbip_dbg_vhci_sysfs("rhport(%u) sockfd(%u) devid(%u) speed(%u)\n",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment