From 7bf12e10430358f324342cf4efdf5fbae36dadfe Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Fri, 7 Jun 2013 10:08:36 +1000 Subject: [PATCH] arch/frv/kernel/setup.c: use strncmp() instead of memcmp() 'cmdline' is a NUL terminated string, when its length < 4, memcmp() will cause memory access out of boundary. So use strncmp() instead of memcmp(). Signed-off-by: Chen Gang Cc: David Howells Signed-off-by: Andrew Morton --- arch/frv/kernel/setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c index f78f8cb44093..ae3a6706419b 100644 --- a/arch/frv/kernel/setup.c +++ b/arch/frv/kernel/setup.c @@ -735,7 +735,7 @@ static void __init parse_cmdline_early(char *cmdline) /* "mem=XXX[kKmM]" sets SDRAM size to , overriding the value we worked * out from the SDRAM controller mask register */ - if (!memcmp(cmdline, "mem=", 4)) { + if (!strncmp(cmdline, "mem=", 4)) { unsigned long long mem_size; mem_size = memparse(cmdline + 4, &cmdline); -- 2.39.5