Skip to contentSkip to conversation

arch: frv: kernel: using strncmp() instead of memcmp()

PATCH New Chen Gang 1 participant 1 message May 30, 2013 Generic include/asm header files

lore
Share & tools
lore

Chen Gang

author
#0 lore raw

PATCH 1/1 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().

---
 arch/frv/kernel/setup.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/frv/kernel/setup.c +1 -1
index a513647..622d5ee 100644
@@ -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);
Signature · 1 line
1.7.7.6