diff options
author | Alban Bedel <albeu@free.fr> | 2014-11-08 06:39:39 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:45:26 -0500 |
commit | 484c344985ddf8e9ed12b8cf540eba0b1d869236 (patch) | |
tree | 5008ab8a2aeeb4c482607660ba36bb5ad5348bf3 /arch/mips/fw | |
parent | 4a792e56cfdbe000d01c01ce356d13f39f5494e7 (diff) |
MIPS: FW: Use kstrtoul() to parse unsigned long from the fw environment
Fix some value corruptions with values that can't be represented in a
signed long.
Signed-off-by: Alban Bedel <albeu@free.fr>
Cc: linux-kernel@vger.kernel.org
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/8358/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/fw')
-rw-r--r-- | arch/mips/fw/lib/cmdline.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c index a0c361e6a5d2..6ecda64ad184 100644 --- a/arch/mips/fw/lib/cmdline.c +++ b/arch/mips/fw/lib/cmdline.c | |||
@@ -88,13 +88,13 @@ unsigned long fw_getenvl(char *envname) | |||
88 | { | 88 | { |
89 | unsigned long envl = 0UL; | 89 | unsigned long envl = 0UL; |
90 | char *str; | 90 | char *str; |
91 | long val; | ||
92 | int tmp; | 91 | int tmp; |
93 | 92 | ||
94 | str = fw_getenv(envname); | 93 | str = fw_getenv(envname); |
95 | if (str) { | 94 | if (str) { |
96 | tmp = kstrtol(str, 0, &val); | 95 | tmp = kstrtoul(str, 0, &envl); |
97 | envl = (unsigned long)val; | 96 | if (tmp) |
97 | envl = 0; | ||
98 | } | 98 | } |
99 | 99 | ||
100 | return envl; | 100 | return envl; |