From: Gabriele Monaco <gmonaco@redhat.com>
To: Wei Li <liwei1412@hotmail.com>,
Steven Rostedt <rostedt@goodmis.org>,
Jonathan Corbet <corbet@lwn.net>,
Shuah Khan <skhan@linuxfoundation.org>,
Randy Dunlap <rdunlap@infradead.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Nam Cao <namcao@linutronix.de>
Cc: linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
liwei391@huawei.com
Subject: Re: [PATCH 6/6] rv: Do not send the trailing NUL to userspace
Date: Mon, 23 Nov 2026 10:10:36 +0100 [thread overview]
Message-ID: <96080be96fbb96ec77e3e015779da807fa4ce64e.camel@redhat.com> (raw)
In-Reply-To: <CY8PR19MB7009D39FB627A9576A9868AFB7682@CY8PR19MB7009.namprd19.prod.outlook.com>
On Wed, 2026-11-04 at 17:21 +0800, Wei Li wrote:
> From: Wei Li <liwei391@huawei.com>
>
> In the rv module, there are three read handlers that pass
> 'strlen(buff) + 1' to simple_read_from_buffer(). The terminator byte is
> not data, so the read returns one extra byte. Pass strlen(buff)
> instead.
>
> Signed-off-by: Wei Li <liwei391@huawei.com>
> ---
Good catch, thanks!
Acked-by: Gabriele Monaco <gmonaco@redhat.com>
> kernel/trace/rv/rv.c | 4 ++--
> kernel/trace/rv/rv_reactors.c | 2 +-
> 2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/rv/rv.c b/kernel/trace/rv/rv.c
> index 7846e4092b9c..835d53978961 100644
> --- a/kernel/trace/rv/rv.c
> +++ b/kernel/trace/rv/rv.c
> @@ -483,7 +483,7 @@ static ssize_t monitor_desc_read_data(struct file *filp,
> char __user *user_buf,
>
> snprintf(buff, sizeof(buff), "%s\n", mon->description);
>
> - return simple_read_from_buffer(user_buf, count, ppos, buff,
> strlen(buff) + 1);
> + return simple_read_from_buffer(user_buf, count, ppos, buff,
> strlen(buff));
> }
>
> static const struct file_operations interface_desc_fops = {
> @@ -752,7 +752,7 @@ static ssize_t monitoring_on_read_data(struct file *filp,
> char __user *user_buf,
>
> buff = rv_monitoring_on() ? "1\n" : "0\n";
>
> - return simple_read_from_buffer(user_buf, count, ppos, buff,
> strlen(buff) + 1);
> + return simple_read_from_buffer(user_buf, count, ppos, buff,
> strlen(buff));
> }
>
> static void turn_monitoring_off(void)
> diff --git a/kernel/trace/rv/rv_reactors.c b/kernel/trace/rv/rv_reactors.c
> index 06f21bcdd6cf..8a4f0740e3ab 100644
> --- a/kernel/trace/rv/rv_reactors.c
> +++ b/kernel/trace/rv/rv_reactors.c
> @@ -353,7 +353,7 @@ static ssize_t reacting_on_read_data(struct file *filp,
>
> buff = rv_reacting_on() ? "1\n" : "0\n";
>
> - return simple_read_from_buffer(user_buf, count, ppos, buff,
> strlen(buff)+1);
> + return simple_read_from_buffer(user_buf, count, ppos, buff,
> strlen(buff));
> }
>
> static void turn_reacting_off(void)
prev parent reply other threads:[~2026-11-23 9:10 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 9:21 [PATCH 0/6] rv: Expose and preserve nested monitor states Wei Li
2026-11-04 9:21 ` [PATCH 1/6] rv: Mark diverged child reactors with a star Wei Li
2026-11-23 8:03 ` Gabriele Monaco
2026-11-04 9:21 ` [PATCH 2/6] rv: Update monitors through a quiesce helper Wei Li
2026-11-23 8:19 ` Gabriele Monaco
2026-11-04 9:21 ` [PATCH 3/6] rv: Show the mixed enable state of containers Wei Li
2026-11-21 14:43 ` Gabriele Monaco
2026-11-04 9:21 ` [PATCH 4/6] Documentation/rv: Document the enable and reactor states Wei Li
2026-11-04 9:21 ` [PATCH 5/6] tools/rv: Parse the mixed enable state of containers Wei Li
2026-11-23 8:24 ` Gabriele Monaco
2026-11-04 9:21 ` [PATCH 6/6] rv: Do not send the trailing NUL to userspace Wei Li
2026-11-23 9:10 ` Gabriele Monaco [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=96080be96fbb96ec77e3e015779da807fa4ce64e.camel@redhat.com \
--to=gmonaco@redhat.com \
--cc=corbet@lwn.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=liwei1412@hotmail.com \
--cc=liwei391@huawei.com \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=namcao@linutronix.de \
--cc=rdunlap@infradead.org \
--cc=rostedt@goodmis.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