Commit 98bd8d05 authored by Chen Gang's avatar Chen Gang Committed by Linus Torvalds

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: default avatarChen Gang <gang.chen@asianux.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 760033c4
...@@ -735,7 +735,7 @@ static void __init parse_cmdline_early(char *cmdline) ...@@ -735,7 +735,7 @@ static void __init parse_cmdline_early(char *cmdline)
/* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked /* "mem=XXX[kKmM]" sets SDRAM size to <mem>, overriding the value we worked
* out from the SDRAM controller mask register * out from the SDRAM controller mask register
*/ */
if (!memcmp(cmdline, "mem=", 4)) { if (!strncmp(cmdline, "mem=", 4)) {
unsigned long long mem_size; unsigned long long mem_size;
mem_size = memparse(cmdline + 4, &cmdline); mem_size = memparse(cmdline + 4, &cmdline);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment