From: Steven Rostedt <rostedt@goodmis.org>
To: Devaansh Kumar <devaanshk840@gmail.com>
Cc: mhiramat@kernel.org, mathieu.desnoyers@efficios.com,
linux-trace-kernel@vger.kernel.org, linux-kernel@vger.kernel.org,
skhan@linuxfoundation.org,
linux-kernel-mentees@lists.linuxfoundation.org
Subject: Re: [PATCH] tracing: Replace deprecated strncpy() with strscpy() for string keys in hist triggers
Date: Wed, 14 May 2025 16:28:57 -0400 [thread overview]
Message-ID: <20250514162857.4a3f846a@gandalf.local.home> (raw)
In-Reply-To: <20250514201956.1447439-1-devaanshk840@gmail.com>
On Thu, 15 May 2025 01:49:55 +0530
Devaansh Kumar <devaanshk840@gmail.com> wrote:
> strncpy() is deprecated for NUL-terminated destination buffers and must
> be replaced by strscpy().
>
> See issue: https://github.com/KSPP/linux/issues/90
>
> Signed-off-by: Devaansh Kumar <devaanshk840@gmail.com>
> ---
> kernel/trace/trace_events_hist.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 1260c23cfa5f..90a4e486fba8 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -5225,7 +5225,7 @@ static inline void add_to_key(char *compound_key, void *key,
> if (size > key_field->size - 1)
> size = key_field->size - 1;
>
> - strncpy(compound_key + key_field->offset, (char *)key, size);
> + strscpy(compound_key + key_field->offset, (char *)key, size);
> } else
> memcpy(compound_key + key_field->offset, key, size);
> }
Incorrect, and this is already fixed in next (at least it's in my ftrace/for-next branch).
https://lore.kernel.org/20250403210637.1c477d4a@gandalf.local.home
-- Steve
prev parent reply other threads:[~2025-05-14 20:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-14 20:19 [PATCH] tracing: Replace deprecated strncpy() with strscpy() for string keys in hist triggers Devaansh Kumar
2025-05-14 20:28 ` Steven Rostedt [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250514162857.4a3f846a@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=devaanshk840@gmail.com \
--cc=linux-kernel-mentees@lists.linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=skhan@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox