Early cmdline parser looks for "disable_radix" substring in the cmdline
string but it could also succeed when cmdline string contains parameters
like 'x_disable_radix' or disable_radix_type=' or such causing undesired
actions. Add support to skip proceeding in such cases.

Fixes: 014d02cbf16b ("powerpc: Update to new option-vector-5 format for CAS")
Cc: sta...@vger.kernel.org # 4.11+
Cc: Suraj Jitindar Singh <sjitindarsi...@gmail.com>
Cc: Michael Ellerman <m...@ellerman.id.au>
Signed-off-by: Hari Bathini <hbath...@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/prom_init.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 3057a32..169e32c 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -660,8 +660,16 @@ static void __init early_cmdline_parse(void)
 
        opt = strstr(prom_cmd_line, "disable_radix");
        if (opt) {
-               prom_debug("Radix disabled from cmdline\n");
-               prom_radix_disable = true;
+               /*
+                * Check if this is prefix or suffix of some other parameter
+                * before proceeding.
+                */
+               p = (char *)(opt + 13);
+               if ((*p == ' ' || *p == '"' || *p == '\0') &&
+                   is_substring_param(prom_cmd_line, opt)) {
+                       prom_debug("Radix disabled from cmdline\n");
+                       prom_radix_disable = true;
+               }
        }
 }
 

Reply via email to