[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250403153651.1188135b@gandalf.local.home>
Date: Thu, 3 Apr 2025 15:36:51 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Devaansh Kumar <devaanshk840@...il.com>
Cc: mhiramat@...nel.org, mathieu.desnoyers@...icios.com,
linux-trace-kernel@...r.kernel.org, linux-kernel@...r.kernel.org,
skhan@...uxfoundation.org, linux-kernel-mentees@...ts.linuxfoundation.org
Subject: Re: [PATCH] tracing: Replace deprecated strncpy() with memcpy() for
stack_trace_filter_buf
On Fri, 4 Apr 2025 00:43:40 +0530
Devaansh Kumar <devaanshk840@...il.com> wrote:
> @@ -537,14 +538,16 @@ stack_trace_sysctl(struct ctl_table *table, int write, void *buffer,
> return ret;
> }
>
> -static char stack_trace_filter_buf[COMMAND_LINE_SIZE+1] __initdata;
> +static char stack_trace_filter_buf[COMMAND_LINE_SIZE+1] __initdata __nonstring;
>
> static __init int enable_stacktrace(char *str)
> {
> int len;
>
> - if ((len = str_has_prefix(str, "_filter=")))
> - strncpy(stack_trace_filter_buf, str + len, COMMAND_LINE_SIZE);
> + len = str_has_prefix(str, "_filter=");
> +
> + if (len)
> + memcpy(stack_trace_filter_buf, str + len, sizeof(stack_trace_filter_buf));
Hmm, this location looks like it can just use strscpy().
-- Steve
>
> stack_tracer_enabled = 1;
> return 1;
> --
Powered by blists - more mailing lists