[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1415359381-27257-2-git-send-email-albeu@free.fr>
Date: Fri, 7 Nov 2014 12:23:01 +0100
From: Alban Bedel <albeu@...e.fr>
To: linux-kernel@...r.kernel.org
Cc: linux-mips@...ux-mips.org, Ralf Baechle <ralf@...ux-mips.org>,
Alban Bedel <albeu@...e.fr>
Subject: [PATCH 2/2] 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@...e.fr>
---
arch/mips/fw/lib/cmdline.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/arch/mips/fw/lib/cmdline.c b/arch/mips/fw/lib/cmdline.c
index cc5d168..e680624 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)
{
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;
--
2.0.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists