[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241018140507.GM1697@kernel.org>
Date: Fri, 18 Oct 2024 15:05:07 +0100
From: Simon Horman <horms@...nel.org>
To: Antoine Tenart <atenart@...nel.org>
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next 1/3] net: sysctl: remove always-true condition
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@...nel.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@...nel.org>
Powered by blists - more mailing lists