From 805a3ce4c3f1b2bf5eb9188423e43fa2ee34d0d2 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Wed, 19 Jun 2013 10:07:05 +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