提交 484c3449 编写于 作者: A Alban Bedel 提交者: Ralf Baechle

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: NAlban 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: NRalf Baechle <ralf@linux-mips.org>
上级 4a792e56
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册