From: John de la Garza <john@jjdev.com>
To: linux-kernel@vger.kernel.org
Cc: linux-usb@vger.kernel.org, devel@driverdev.osuosl.org
Subject: [PATCH] usbip:usbip_common.c: check return value of sscanf
Date: Thu, 6 Mar 2014 15:51:59 -0800 [thread overview]
Message-ID: <20140306235156.GA3498@vega.jjdev.com> (raw)
Added code to check return value of sscanf.
Signed-off-by: John de la Garza <john@jjdev.com>
---
drivers/staging/usbip/usbip_common.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c
index 4a2aab1..2a11233 100644
--- a/drivers/staging/usbip/usbip_common.c
+++ b/drivers/staging/usbip/usbip_common.c
@@ -55,7 +55,8 @@ static ssize_t usbip_debug_store(struct device *dev,
struct device_attribute *attr, const char *buf,
size_t count)
{
- sscanf(buf, "%lx", &usbip_debug_flag);
+ if (sscanf(buf, "%lx", &usbip_debug_flag) != 1)
+ return -EINVAL;
return count;
}
DEVICE_ATTR_RW(usbip_debug);
--
1.7.10.4
next reply other threads:[~2014-03-06 23:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 23:51 John de la Garza [this message]
2014-03-07 0:17 ` [PATCH] usbip:usbip_common.c: check return value of sscanf Joe Perches
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140306235156.GA3498@vega.jjdev.com \
--to=john@jjdev.com \
--cc=devel@driverdev.osuosl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox