Commit f8cfc023 authored by Elena Oat's avatar Elena Oat Committed by Greg Kroah-Hartman

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: default avatarElena Oat <oat.elena@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fdffa6f2
......@@ -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");
......
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