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>
This commit is contained in:
Elena Oat 2014-02-27 12:26:52 +02:00 committed by Greg Kroah-Hartman
parent fdffa6f2b3
commit f8cfc02309
1 changed files with 4 additions and 1 deletions

View File

@ -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");