dyndbg: fix old BUG_ON in >control parser
authorJim Cromie <jim.cromie@gmail.com>
Mon, 29 Apr 2024 19:31:11 +0000 (13:31 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Apr 2024 07:20:48 +0000 (09:20 +0200)
Fix a BUG_ON from 2009.  Even if it looks "unreachable" (I didn't
really look), lets make sure by removing it, doing pr_err and return
-EINVAL instead.

Cc: stable <stable@kernel.org>
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
Link: https://lore.kernel.org/r/20240429193145.66543-2-jim.cromie@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
lib/dynamic_debug.c

index c78f335fa98137664745e6593c98b707a528bf34..f2c5e7910bb19122f29d93b0c1e896638738b1a3 100644 (file)
@@ -302,7 +302,11 @@ static int ddebug_tokenize(char *buf, char *words[], int maxwords)
                } else {
                        for (end = buf; *end && !isspace(*end); end++)
                                ;
-                       BUG_ON(end == buf);
+                       if (end == buf) {
+                               pr_err("parse err after word:%d=%s\n", nwords,
+                                      nwords ? words[nwords - 1] : "<none>");
+                               return -EINVAL;
+                       }
                }
 
                /* `buf' is start of word, `end' is one past its end */