From: Jinjie Ruan <ruanjinjie@huawei.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: <mhiramat@kernel.org>, <mathieu.desnoyers@efficios.com>,
<linux-kernel@vger.kernel.org>,
<linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing: Replace strncpy() with strscpy() when copying comm
Date: Thu, 31 Oct 2024 09:47:29 +0800 [thread overview]
Message-ID: <0ccbb6b9-27a2-7afc-c47e-4ac9c71a23b6@huawei.com> (raw)
In-Reply-To: <20241030194006.4d29417c@rorschach.local.home>
On 2024/10/31 7:40, Steven Rostedt wrote:
> On Wed, 31 Jul 2024 15:50:58 +0800
> Jinjie Ruan <ruanjinjie@huawei.com> wrote:
>
>> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
>> index 6ece1308d36a..4ee0e64719fa 100644
>> --- a/kernel/trace/trace_events_hist.c
>> +++ b/kernel/trace/trace_events_hist.c
>> @@ -1599,7 +1599,7 @@ static inline void save_comm(char *comm, struct task_struct *task)
>> return;
>> }
>>
>> - strncpy(comm, task->comm, TASK_COMM_LEN);
>> + strscpy(comm, task->comm);
>> }
>>
>
> Was this even compiled?
Sorry, the trace_events_hist.c was left out, will fix it.
>
> In file included from /work/git/test-linux.git/include/linux/container_of.h:5,
> from /work/git/test-linux.git/include/linux/list.h:5,
> from /work/git/test-linux.git/include/linux/module.h:12,
> from /work/git/test-linux.git/kernel/trace/trace_events_hist.c:8:
> /work/git/test-linux.git/kernel/trace/trace_events_hist.c: In function ‘save_comm’:
> /work/git/test-linux.git/include/linux/build_bug.h:16:51: error: negative width in bit-field ‘<anonymous>’
> 16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
> | ^
> /work/git/test-linux.git/include/linux/compiler.h:243:33: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’
> 243 | #define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
> | ^~~~~~~~~~~~~~~~~
> /work/git/test-linux.git/include/linux/string.h:79:47: note: in expansion of macro ‘__must_be_array’
> 79 | sized_strscpy(dst, src, sizeof(dst) + __must_be_array(dst) + \
> | ^~~~~~~~~~~~~~~
> /work/git/test-linux.git/include/linux/args.h:25:24: note: in expansion of macro ‘__strscpy0’
> 25 | #define __CONCAT(a, b) a ## b
> | ^
> /work/git/test-linux.git/include/linux/args.h:26:27: note: in expansion of macro ‘__CONCAT’
> 26 | #define CONCATENATE(a, b) __CONCAT(a, b)
> | ^~~~~~~~
> /work/git/test-linux.git/include/linux/string.h:113:9: note: in expansion of macro ‘CONCATENATE’
> 113 | CONCATENATE(__strscpy, COUNT_ARGS(__VA_ARGS__))(dst, src, __VA_ARGS__)
> | ^~~~~~~~~~~
> /work/git/test-linux.git/kernel/trace/trace_events_hist.c:1602:9: note: in expansion of macro ‘strscpy’
> 1602 | strscpy(comm, task->comm);
> | ^~~~~~~
>
> Bah!
>
> -- Steve
>
prev parent reply other threads:[~2024-10-31 1:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-31 7:50 [PATCH] tracing: Replace strncpy() with strscpy() when copying comm Jinjie Ruan
2024-08-27 18:22 ` Justin Stitt
2024-10-30 23:40 ` Steven Rostedt
2024-10-31 1:47 ` Jinjie Ruan [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=0ccbb6b9-27a2-7afc-c47e-4ac9c71a23b6@huawei.com \
--to=ruanjinjie@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.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