Commit 88fa1ebf authored by John de la Garza's avatar John de la Garza Committed by Greg Kroah-Hartman

staging: usbip: vhci_sysfs.c: check return value of sscanf

Added code to check return value of sscanf.
Signed-off-by: default avatarJohn de la Garza <john@jjdev.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d6299470
...@@ -114,7 +114,8 @@ static ssize_t store_detach(struct device *dev, struct device_attribute *attr, ...@@ -114,7 +114,8 @@ static ssize_t store_detach(struct device *dev, struct device_attribute *attr,
int err; int err;
__u32 rhport = 0; __u32 rhport = 0;
sscanf(buf, "%u", &rhport); if (sscanf(buf, "%u", &rhport) != 1)
return -EINVAL;
/* check rhport */ /* check rhport */
if (rhport >= VHCI_NPORTS) { if (rhport >= VHCI_NPORTS) {
...@@ -182,7 +183,8 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, ...@@ -182,7 +183,8 @@ 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
*/ */
sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed); if (sscanf(buf, "%u %u %u %u", &rhport, &sockfd, &devid, &speed) != 1)
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",
rhport, sockfd, devid, speed); rhport, sockfd, devid, speed);
......
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