Early cmdline parser looks for "mem=" substring in the cmdline
string but it could also succeed when cmdline string contains
parameters like 'fadump_reserve_mem=' or such leading to undesired
results. Add support to skip proceeding in such case.

Fixes: cf68787b68a2 ("powerpc/prom_init: Evaluate mem kernel parameter for 
early allocation")
Cc: sta...@vger.kernel.org # 2.6.32+
Cc: Benjamin Krill <b...@codiert.org>
Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org>
Signed-off-by: Hari Bathini <hbath...@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/prom_init.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 7030145..3057a32 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -649,7 +649,7 @@ static void __init early_cmdline_parse(void)
        }
 #endif
        opt = strstr(prom_cmd_line, "mem=");
-       if (opt) {
+       if (opt && is_substring_param(prom_cmd_line, opt)) {
                opt += 4;
                prom_memory_limit = prom_memparse(opt, (const char **)&opt);
 #ifdef CONFIG_PPC64

Reply via email to