From: Jim Cromie <[email protected]>

ddebug_dyndbg_param_cb() passes an RO flags string "+p" to
ddebug_exec_queries() when no explicit param value is given, but
callee may attempt to modify it.  Fix by adding a local mutable var,
init'd with that value, and passing it instead.

Signed-off-by: Jim Cromie <[email protected]>
---
 lib/dynamic_debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index efde85c7a9c1..023784dcdc80 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -1634,8 +1634,9 @@ static int ddebug_add_module(struct _ddebug_info *di)
 
 /* helper for ddebug_dyndbg_(boot|module)_param_cb */
 static int ddebug_dyndbg_param_cb(char *param, char *val,
-                               const char *modname, int on_err)
+                                 const char *modname, int on_err)
 {
+       char dflt_flags[] = "+p";
        char *sep;
 
        sep = strchr(param, '.');
@@ -1648,7 +1649,7 @@ static int ddebug_dyndbg_param_cb(char *param, char *val,
        if (strcmp(param, "dyndbg"))
                return on_err; /* determined by caller */
 
-       ddebug_exec_queries((val ? val : "+p"), modname);
+       ddebug_exec_queries((val ? val : dflt_flags), modname);
 
        return 0; /* query failure shouldn't stop module load */
 }

-- 
2.56.0


Reply via email to