* [PATCH] arch: frv: kernel: using strncmp() instead of memcmp()
@ 2013-05-30 3:13 Chen Gang
0 siblings, 0 replies; only message in thread
From: Chen Gang @ 2013-05-30 3:13 UTC (permalink / raw)
To: dhowells@redhat.com, ak, Geert Uytterhoeven
Cc: Andrew Morton, Greg KH, linux-kernel@vger.kernel.org, Linux-Arch
'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@asianux.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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2013-05-30 3:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-30 3:13 [PATCH] arch: frv: kernel: using strncmp() instead of memcmp() Chen Gang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox