diff options
author | Elena Oat <oat.elena@gmail.com> | 2014-02-27 11:26:52 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-02-28 00:12:11 +0100 |
commit | f8cfc0230909077d2e378c829ffeb7bdf71a890e (patch) | |
tree | 95098ed685dcd3e4cdeb255dde2c34e9c4cb9f3b | |
parent | imx-drm: imx-drm-core: Staticize imx_drm_find_crtc() (diff) | |
download | linux-f8cfc0230909077d2e378c829ffeb7bdf71a890e.tar.xz linux-f8cfc0230909077d2e378c829ffeb7bdf71a890e.zip |
Staging: usbip: Fix the warning of unchecked sscanf return value.
The return value of sscanf in stub_dev.c is not checked. This patch
adds the checking of the return value.
Signed-off-by: Elena Oat <oat.elena@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/staging/usbip/stub_dev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/staging/usbip/stub_dev.c b/drivers/staging/usbip/stub_dev.c index b0bfd3430d47..60a3e3fe4dcb 100644 --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -87,13 +87,16 @@ static ssize_t store_sockfd(struct device *dev, struct device_attribute *attr, int sockfd = 0; struct socket *socket; ssize_t err = -EINVAL; + int rv; if (!sdev) { dev_err(dev, "sdev is null\n"); return -ENODEV; } - sscanf(buf, "%d", &sockfd); + rv = sscanf(buf, "%d", &sockfd); + if (rv != 1) + return -EINVAL; if (sockfd != -1) { dev_info(dev, "stub up\n"); |