From: Michal Nazarewicz <mpn@google.com>
To: Felipe Balbi <balbi@ti.com>, linux-usb@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Benoit Goby <benoit@android.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] usb: gadget: FunctionFS: Use kstrtoul()
Date: Wed, 9 Jan 2013 10:17:47 +0100 [thread overview]
Message-ID: <a2f4648457ce533fd08d87ac044be5e759b4622b.1357722590.git.mina86@mina86.com> (raw)
In-Reply-To: <1357703829-26621-1-git-send-email-benoit@android.com>
From: Michal Nazarewicz <mina86@mina86.com>
kstrtoul() checks for overflow which simple_strtoul() does not pluss
it has “*end == 0” check in it as well. As a side effect, a new
line character is now accepted, but this should not be an issue.
Signed-off-by: Michal Nazarewicz <mina86@mina86.com>
---
Patch on top of v3.5 with Benoit Goby's “Fix missing braces in
parse_opts” patch
(<id:1357703829-26621-1-git-send-email-benoit@android.com>) applied.
drivers/usb/gadget/f_fs.c | 5 ++---
1 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/gadget/f_fs.c b/drivers/usb/gadget/f_fs.c
index 8c2f251..38388d7 100644
--- a/drivers/usb/gadget/f_fs.c
+++ b/drivers/usb/gadget/f_fs.c
@@ -1103,8 +1103,8 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
return 0;
for (;;) {
- char *end, *eq, *comma;
unsigned long value;
+ char *eq, *comma;
/* Option limit */
comma = strchr(opts, ',');
@@ -1120,8 +1120,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts)
*eq = 0;
/* Parse value */
- value = simple_strtoul(eq + 1, &end, 0);
- if (unlikely(*end != ',' && *end != 0)) {
+ if (kstrtoul(eq + 1, 0, &value)) {
pr_err("%s: invalid value: %s\n", opts, eq + 1);
return -EINVAL;
}
--
1.7.7.3
next prev parent reply other threads:[~2013-01-09 9:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 3:57 [PATCH] usb: gadget: FunctionFS: Fix missing braces in parse_opts Benoit Goby
2013-01-09 8:08 ` Michal Nazarewicz
2013-01-09 9:17 ` Michal Nazarewicz [this message]
2013-01-09 9:17 ` [PATCH 2/2] usb: gadget: FunctionFS: Refactor option parsing Michal Nazarewicz
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=a2f4648457ce533fd08d87ac044be5e759b4622b.1357722590.git.mina86@mina86.com \
--to=mpn@google.com \
--cc=balbi@ti.com \
--cc=benoit@android.com \
--cc=gregkh@linuxfoundation.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
all inboxes | Powered by JetHome®