[PATCH] tracing: probes: Replace strcpy() with memcpy() in __trace_probe_log_err()

Thorsten Blum posted 1 patch 1 month, 2 weeks ago
kernel/trace/trace_probe.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] tracing: probes: Replace strcpy() with memcpy() in __trace_probe_log_err()
Posted by Thorsten Blum 1 month, 2 weeks ago
strcpy() is deprecated; use memcpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 kernel/trace/trace_probe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
index 5cbdc423afeb..d3ba5869d32c 100644
--- a/kernel/trace/trace_probe.c
+++ b/kernel/trace/trace_probe.c
@@ -214,7 +214,7 @@ void __trace_probe_log_err(int offset, int err_type)
 	p = command;
 	for (i = 0; i < trace_probe_log.argc; i++) {
 		len = strlen(trace_probe_log.argv[i]);
-		strcpy(p, trace_probe_log.argv[i]);
+		memcpy(p, trace_probe_log.argv[i], len);
 		p[len] = ' ';
 		p += len + 1;
 	}
-- 
2.50.1
Re: [PATCH] tracing: probes: Replace strcpy() with memcpy() in __trace_probe_log_err()
Posted by Masami Hiramatsu (Google) 1 month, 1 week ago
On Wed, 20 Aug 2025 23:47:18 +0200
Thorsten Blum <thorsten.blum@linux.dev> wrote:

> strcpy() is deprecated; use memcpy() instead.
> 
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>

OK, looks good to me.

Thanks,

> ---
>  kernel/trace/trace_probe.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c
> index 5cbdc423afeb..d3ba5869d32c 100644
> --- a/kernel/trace/trace_probe.c
> +++ b/kernel/trace/trace_probe.c
> @@ -214,7 +214,7 @@ void __trace_probe_log_err(int offset, int err_type)
>  	p = command;
>  	for (i = 0; i < trace_probe_log.argc; i++) {
>  		len = strlen(trace_probe_log.argv[i]);
> -		strcpy(p, trace_probe_log.argv[i]);
> +		memcpy(p, trace_probe_log.argv[i], len);
>  		p[len] = ' ';
>  		p += len + 1;
>  	}
> -- 
> 2.50.1
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>
Re: [PATCH] tracing: probes: Replace strcpy() with memcpy() in __trace_probe_log_err()
Posted by Thorsten Blum 3 weeks, 4 days ago
Hi Masami,

On 25. Aug 2025, at 09:05, Masami Hiramatsu (Google) wrote:
> On Wed, 20 Aug 2025 23:47:18 +0200
> Thorsten Blum <thorsten.blum@linux.dev> wrote:
> 
>> strcpy() is deprecated; use memcpy() instead.
>> 
>> Link: https://github.com/KSPP/linux/issues/88
>> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> 
> OK, looks good to me.

Did you forget to add a Reviewed-by: tag and/or to add it to your tree?

Thanks,
Thorsten
Re: [PATCH] tracing: probes: Replace strcpy() with memcpy() in __trace_probe_log_err()
Posted by Masami Hiramatsu (Google) 3 weeks, 4 days ago
On Mon, 8 Sep 2025 12:13:23 +0200
Thorsten Blum <thorsten.blum@linux.dev> wrote:

> Hi Masami,
> 
> On 25. Aug 2025, at 09:05, Masami Hiramatsu (Google) wrote:
> > On Wed, 20 Aug 2025 23:47:18 +0200
> > Thorsten Blum <thorsten.blum@linux.dev> wrote:
> > 
> >> strcpy() is deprecated; use memcpy() instead.
> >> 
> >> Link: https://github.com/KSPP/linux/issues/88
> >> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > 
> > OK, looks good to me.
> 
> Did you forget to add a Reviewed-by: tag and/or to add it to your tree?

Thanks for ping me. No problem, I will add my Signed-by when
picking this to probes/for-next.
Since I will be responsible for applying this patch and sending
it to Linus, this includes the "Reviewed-by" as well.

Thank you,

> 
> Thanks,
> Thorsten
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>