Re: [PATCH v2] net: niu: fix potential buffer overflow/truncation in irq names

Simon Horman <[email protected]>
Newsgroups org.kernel.vger.netdev
Message-ID <[email protected]>
On Mon, Aug 03, 2026 at 11:11:49PM +0200, Ronan Marchal wrote:
> Building with W=1 reports a -Wformat-truncation warning on
> niu_set_irq_name(): the "%s:SYSERR" format could be truncated
> because irq_name[] was one byte too small for the worst case
> interface name length (IFNAMSIZ-1) plus the ":SYSERR" suffix.
> 
> Increase the irq_name buffer size to account for the suffix and
> replace the remaining sprintf() calls in the same function with
> snprintf() to avoid possible buffer overflows.
> 
> Tested:
> - Built the kernel with W=1 and confirmed the warning is no longer reported.
> - No NIU hardware was available for runtime testing.
> 
> Signed-off-by: Ronan Marchal <[email protected]>

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

FTR, I will list my feedback to the AI-generated review of this patch
available at
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260803211149.10585-1-ronanmarchal29%40gmail.com


1. -Wformat-overflow is the correct diagnostic rather than -Wformat-truncation

   Yes, I agree. But I don't think a respin is warranted only to address this.

2. Suggestion to add a fixes tag

   No, this is addresses a theoretical concern rather than a bug
   that manifests. It should not have a fixes tag.

3. Claim that not all sprintf() calls in the function have been updated as
   the commit message seems to claim.

   This appears to be true. But I don't think it warrants a respin.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.