]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
arch/frv/kernel/setup.c: use strncmp() instead of memcmp()
authorChen Gang <gang.chen@asianux.com>
Fri, 7 Jun 2013 00:08:36 +0000 (10:08 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 7 Jun 2013 05:42:40 +0000 (15:42 +1000)
'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 <gang.chen@asianux.com>
Cc: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
arch/frv/kernel/setup.c

index f78f8cb44093d8fdd36d04efdd975f0560b47e8c..ae3a6706419bcf5b6ada7f12c95e3b68dbdbd3d0 100644 (file)
@@ -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
                 * 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);