[<prev] [next>] [day] [month] [year] [list]
Message-ID: <51A6C3DD.70209@asianux.com>
Date: Thu, 30 May 2013 11:13:33 +0800
From: Chen Gang <gang.chen@...anux.com>
To: "dhowells@...hat.com" <dhowells@...hat.com>, ak@...ux.intel.com,
Geert Uytterhoeven <geert@...ux-m68k.org>
CC: Andrew Morton <akpm@...ux-foundation.org>,
Greg KH <gregkh@...uxfoundation.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Linux-Arch <linux-arch@...r.kernel.org>
Subject: [PATCH] arch: frv: kernel: using strncmp() instead of memcmp()
'cmdline' is a NUL terminated string, when its length < 4, memcmp()
will cause memory access out of boundary.
So need use strncmp() instead of memcmp().
Signed-off-by: Chen Gang <gang.chen@...anux.com>
---
arch/frv/kernel/setup.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/arch/frv/kernel/setup.c b/arch/frv/kernel/setup.c
index a513647..622d5ee 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 <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);
--
1.7.7.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists