diff options
author | John de la Garza <john@jjdev.com> | 2014-03-06 10:36:34 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-03-06 11:58:31 -0800 |
commit | 88fa1ebfa21b5deaaad2dc88ecd9f6af91796cf7 (patch) | |
tree | ffbd976dca87a0023195a422ff31a0fbf9cdca26 /drivers/staging | |
parent | d62994701b1e38794a6e4dfc54beb9ae98d3d822 (diff) | |
download | linux-88fa1ebfa21b5deaaad2dc88ecd9f6af91796cf7.tar.bz2 |
staging: usbip: vhci_sysfs.c: check return value of sscanf
Added code to check return value of sscanf.
Signed-off-by: John de la Garza <john@jjdev.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/usbip/vhci_sysfs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c index 03e6edf46e7c..82dd49f7df9e 100644 --- a/drivers/staging/usbip/vhci_sysfs.c +++ b/drivers/staging/usbip/vhci_sysfs.c @@ -114,7 +114,8 @@ static ssize_t store_detach(struct device *dev, struct device_attribute *attr, int err; __u32 rhport = 0; - sscanf(buf, "%u", &rhport); + if (sscanf(buf, "%u", &rhport) != 1) + return -EINVAL; /* check rhport */ if (rhport >= VHCI_NPORTS) { @@ -182,7 +183,8 @@ static ssize_t store_attach(struct device *dev, struct device_attribute *attr, * @devid: unique device identifier 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", rhport, sockfd, devid, speed); |