diff options
author | Michal Nazarewicz <mina86@mina86.com> | 2013-01-09 04:17:47 -0500 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2013-01-10 05:42:14 -0500 |
commit | afd2e186bd7e58dc9d298ff5fb5a2fc30578867e (patch) | |
tree | 1218ca710f61fb570b110279211739e406fc67c0 /drivers/usb/gadget/f_fs.c | |
parent | cd76213eb57c505d3df6fa3134a6b3bb5394a90c (diff) |
usb: gadget: FunctionFS: Use kstrtoul()
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>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget/f_fs.c')
-rw-r--r-- | 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 4a6961c517f2..449186c9fd6c 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) | |||
1103 | return 0; | 1103 | return 0; |
1104 | 1104 | ||
1105 | for (;;) { | 1105 | for (;;) { |
1106 | char *end, *eq, *comma; | ||
1107 | unsigned long value; | 1106 | unsigned long value; |
1107 | char *eq, *comma; | ||
1108 | 1108 | ||
1109 | /* Option limit */ | 1109 | /* Option limit */ |
1110 | comma = strchr(opts, ','); | 1110 | comma = strchr(opts, ','); |
@@ -1120,8 +1120,7 @@ static int ffs_fs_parse_opts(struct ffs_sb_fill_data *data, char *opts) | |||
1120 | *eq = 0; | 1120 | *eq = 0; |
1121 | 1121 | ||
1122 | /* Parse value */ | 1122 | /* Parse value */ |
1123 | value = simple_strtoul(eq + 1, &end, 0); | 1123 | if (kstrtoul(eq + 1, 0, &value)) { |
1124 | if (unlikely(*end != ',' && *end != 0)) { | ||
1125 | pr_err("%s: invalid value: %s\n", opts, eq + 1); | 1124 | pr_err("%s: invalid value: %s\n", opts, eq + 1); |
1126 | return -EINVAL; | 1125 | return -EINVAL; |
1127 | } | 1126 | } |