Subject: Re: [PATCH net-next 1/3] net: sysctl: remove always-true condition

From: Simon Horman <[email-masked]>
Date: Fri, 18 Oct 2024 15:05:07 +0100

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 <[email-masked]>

Thanks for separating out this and patch 2/3.
It makes it much easier to reason with these changes.

Reviewed-by: Simon Horman <[email-masked]>