diff options
author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-06-10 12:03:21 +0100 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2024-06-10 12:03:21 +0100 |
commit | 594ce0b8a998aa4d05827cd7c0d0dcec9a1e3ae2 (patch) | |
tree | 070bd60a8fda15e5f47339d3f6888a0fe2ca6fe9 /lib/dynamic_debug.c | |
parent | 616501eccb58615f8f352a29239ea6c6fc5e6546 (diff) | |
parent | e3cf20e5c68df604315ab30bdbe15dc8a5da556b (diff) |
Merge topic branches 'clkdev' and 'fixes' into for-linus
Diffstat (limited to 'lib/dynamic_debug.c')
-rw-r--r-- | lib/dynamic_debug.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 6fba6423cc10..f2c5e7910bb1 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -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 */ @@ -640,10 +644,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; |