[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3a04ad94-f8c3-4d2e-c6a2-d498ac3cbeb0@linaro.org>
Date: Fri, 26 Mar 2021 11:31:20 -0500
From: Alex Elder <elder@...aro.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>,
Johan Hovold <johan@...nel.org>, Alex Elder <elder@...nel.org>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: greybus-dev@...ts.linaro.org, linux-kernel@...r.kernel.org
Subject: Re: [greybus-dev] [PATCH] greybus: remove stray nul byte in
apb_log_enable_read output
On 3/26/21 10:22 AM, Rasmus Villemoes wrote:
> Including a nul byte in the otherwise human-readable ascii output
> from this debugfs file is probably not intended.
Looking only at the comments above simple_read_from_buffer(),
the last argument is the size of the buffer (tmp_buf in this
case). So "3" is proper.
But looking at callers, it seems that the trailing NUL is
often excluded this way.
I don't really have a problem with your patch, but could
you explain why having the NUL byte included is an actual
problem? A short statement about that would provide better
context than just "probably not intended."
Thanks.
-Alex
>
> Signed-off-by: Rasmus Villemoes <linux@...musvillemoes.dk>
> ---
> drivers/greybus/es2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/greybus/es2.c b/drivers/greybus/es2.c
> index 48ad154df3a7..86a7fbc7fe13 100644
> --- a/drivers/greybus/es2.c
> +++ b/drivers/greybus/es2.c
> @@ -1171,7 +1171,7 @@ static ssize_t apb_log_enable_read(struct file *f, char __user *buf,
> char tmp_buf[3];
>
> sprintf(tmp_buf, "%d\n", enable);
> - return simple_read_from_buffer(buf, count, ppos, tmp_buf, 3);
> + return simple_read_from_buffer(buf, count, ppos, tmp_buf, 2);
> }
>
> static ssize_t apb_log_enable_write(struct file *f, const char __user *buf,
>
Powered by blists - more mailing lists