* [PATCH v1 1/1] dyndbg: Replace kstrdup() + strchr() with kstrdup_and_replace()
@ 2024-02-13 16:27 Andy Shevchenko
2024-02-13 19:14 ` Luis Chamberlain
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2024-02-13 16:27 UTC (permalink / raw)
To: Luis Chamberlain, Jason Baron, linux-kernel
Cc: Andrew Morton, Jim Cromie, Andy Shevchenko
Replace open coded functionalify of kstrdup_and_replace() with a call.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
lib/dynamic_debug.c | 7 +++----
1 file 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;
--
2.43.0.rc1.1.gbec44491f096
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v1 1/1] dyndbg: Replace kstrdup() + strchr() with kstrdup_and_replace()
2024-02-13 16:27 [PATCH v1 1/1] dyndbg: Replace kstrdup() + strchr() with kstrdup_and_replace() Andy Shevchenko
@ 2024-02-13 19:14 ` Luis Chamberlain
0 siblings, 0 replies; 2+ messages in thread
From: Luis Chamberlain @ 2024-02-13 19:14 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: Jason Baron, linux-kernel, Andrew Morton, Jim Cromie
On Tue, Feb 13, 2024 at 06:27:41PM +0200, Andy Shevchenko wrote:
> Replace open coded functionalify of kstrdup_and_replace() with a call.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-02-13 19:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 16:27 [PATCH v1 1/1] dyndbg: Replace kstrdup() + strchr() with kstrdup_and_replace() Andy Shevchenko
2024-02-13 19:14 ` Luis Chamberlain
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®