From: Simon Horman <horms@kernel.org>
To: Antoine Tenart <atenart@kernel.org>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
edumazet@google.com, netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/3] net: sysctl: remove always-true condition
Date: Fri, 18 Oct 2024 15:05:07 +0100 [thread overview]
Message-ID: <20241018140507.GM1697@kernel.org> (raw)
In-Reply-To: <20241017152422.487406-2-atenart@kernel.org>
On Thu, Oct 17, 2024 at 05:24:17PM +0200, Antoine Tenart wrote:
> Before adding a new line at the end of the temporary buffer in
> dump_cpumask, a length check is performed to ensure there is space for
> it.
>
> len = min(sizeof(kbuf) - 1, *lenp);
> len = scnprintf(kbuf, len, ...);
> if (len < *lenp)
> kbuf[len++] = '\n';
>
> Note that the check is currently logically wrong, the written length is
> compared against the output buffer, not the temporary one. However this
> has no consequence as this is always true, even if fixed: scnprintf
> includes a null char at the end of the buffer but the returned length do
> not include it and there is always space for overriding it with a
> newline.
>
> Remove the condition.
>
> Signed-off-by: Antoine Tenart <atenart@kernel.org>
Thanks for separating out this and patch 2/3.
It makes it much easier to reason with these changes.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2024-10-18 14:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-17 15:24 [PATCH net-next 0/3] net: sysctl: allow dump_cpumask to handle higher numbers of CPUs Antoine Tenart
2024-10-17 15:24 ` [PATCH net-next 1/3] net: sysctl: remove always-true condition Antoine Tenart
2024-10-18 14:05 ` Simon Horman [this message]
2024-10-17 15:24 ` [PATCH net-next 2/3] net: sysctl: do not reserve an extra char in dump_cpumask temporary buffer Antoine Tenart
2024-10-17 15:24 ` [PATCH net-next 3/3] net: sysctl: allow dump_cpumask to handle higher numbers of CPUs Antoine Tenart
2024-10-18 14:04 ` Simon Horman
2024-10-18 14:05 ` Simon Horman
2024-10-23 8:40 ` [PATCH net-next 0/3] " patchwork-bot+netdevbpf
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=20241018140507.GM1697@kernel.org \
--to=horms@kernel.org \
--cc=atenart@kernel.org \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/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;
as well as URLs for NNTP newsgroup(s).