diff options
| author | Andy Shevchenko <[email protected]> | 2024-02-13 16:27:41 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-03-06 21:07:39 +0000 |
| commit | 9bea6216f94bb711267e01f6ff8b07e3ff1e22d6 (patch) | |
| tree | 0115b395e57313ffd72406b3383cb9fac267b417 /lib/dynamic_debug.c | |
| parent | list: leverage list_is_head() for list_entry_is_head() (diff) | |
| download | kernel-9bea6216f94bb711267e01f6ff8b07e3ff1e22d6.tar.gz kernel-9bea6216f94bb711267e01f6ff8b07e3ff1e22d6.zip | |
dyndbg: replace kstrdup() + strchr() with kstrdup_and_replace()
Replace open coded functionalify of kstrdup_and_replace() with a call.
Link: https://lkml.kernel.org/r/[email protected]
Signed-off-by: Andy Shevchenko <[email protected]>
Reviewed-by: Luis Chamberlain <[email protected]>
Cc: Jason Baron <[email protected]>
Cc: Jim Cromie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/dynamic_debug.c')
| -rw-r--r-- | lib/dynamic_debug.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c index 6fba6423cc10..c78f335fa981 100644 --- a/lib/dynamic_debug.c +++ b/lib/dynamic_debug.c @@ -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; |
