Skip to content

Commit

Permalink
MIPS: FW: Use kstrtoul() to parse unsigned long from the fw environment
Browse files Browse the repository at this point in the history
Fix some value corruptions with values that can't be represented in a
signed long.

Signed-off-by: Alban Bedel <[email protected]>
Cc: [email protected]
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/8358/
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
AlbanBedel authored and ralfbaechle committed Nov 24, 2014
1 parent 4a792e5 commit 484c344
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions arch/mips/fw/lib/cmdline.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ unsigned long fw_getenvl(char *envname)
{
unsigned long envl = 0UL;
char *str;
long val;
int tmp;

str = fw_getenv(envname);
if (str) {
tmp = kstrtol(str, 0, &val);
envl = (unsigned long)val;
tmp = kstrtoul(str, 0, &envl);
if (tmp)
envl = 0;
}

return envl;
Expand Down

0 comments on commit 484c344

Please sign in to comment.