Merge tag 'mm-nonmm-stable-2024-03-14-09-36' of git://git.kernel.org/pub/scm/linux...
[linux-2.6-microblaze.git] / lib / dynamic_debug.c
index 6fba642..c78f335 100644 (file)
@@ -640,10 +640,9 @@ static int param_set_dyndbg_classnames(const char *instr, const struct kernel_pa
        int cls_id, totct = 0;
        bool wanted;
 
-       cl_str = tmp = kstrdup(instr, GFP_KERNEL);
-       p = strchr(cl_str, '\n');
-       if (p)
-               *p = '\0';
+       cl_str = tmp = kstrdup_and_replace(instr, '\n', '\0', GFP_KERNEL);
+       if (!tmp)
+               return -ENOMEM;
 
        /* start with previously set state-bits, then modify */
        curr_bits = old_bits = *dcp->bits;