Re: [PATCH net-next v2 1/2] cxgb4: size the MSI-X interrupt name buffer

From: netdev-bot+sashiko

Date: Sat Dec 05 2026 - 05:04:50 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message for "cxgb4: size the MSI-X interrupt name
buffer" gets some of its arithmetic wrong, and it leaves out a user-…

--

cxgb4: size the MSI-X interrupt name buffer

This commit grows desc[] in struct msix_info from IFNAMSIZ + 10 to
2 * IFNAMSIZ + 11 bytes. After the change, the snprintf() calls that build
MSI-X interrupt names in setup_sge_queues(),
cxgb4_port_mirror_alloc_queues() and alloc_uld_rxqs() can no longer
truncate. This fixes the -Wformat-truncation errors in W=1 builds with
CONFIG_WERROR.

Link: https://lore.kernel.org/oe-kbuild-all/202604141419.a4vuNBN7-lkp@xxxxxxxxx/

> The MSI-X interrupt names are assembled with snprintf() into
> adap->msix_info[].desc[IFNAMSIZ + 10], from adap->port[0]->name (up to
> IFNAMSIZ - 1 characters) plus a suffix and a queue index:
>
> "%s-Rx%d" needs IFNAMSIZ - 1 + 3 + 5 + 1 = 24 bytes

[Severity: Low]
The new size looks right to me, but is the 24 byte figure for "%s-Rx%d"
correct?

In setup_sge_queues() the queue index is a plain int:

int err, i, j, msix = 0;
...
snprintf(adap->msix_info[msix].desc,
sizeof(adap->msix_info[msix].desc),
"%s-Rx%d", dev->name, j);

So %d can produce up to 11 characters, and the worst case is
15 + 3 + 11 + 1 = 30 bytes.

If the format only needed 24 bytes, it would fit in the old 26 byte
desc[] and would not warn. But the first compiler error quoted further
down is for this format, and it says:

> cxgb4_main.c:1074:48: error: '%d' directive output may be truncated
> writing between 1 and 11 bytes into a region of size between 8 and 23

The 5 digit assumption only holds for "%s-mirrorrxq%d", where i is a u16
in cxgb4_port_mirror_alloc_queues().

The changelog also presents this only as a build failure. Doesn't it change
runtime behaviour as well? Before this patch, alloc_uld_rxqs() could
truncate the name at runtime:

snprintf(adap->msix_info[msi_idx].desc,
sizeof(adap->msix_info[msi_idx].desc),
"%s-%s%d",
adap->port[0]->name, rxq_info->name, i);

Take a 15 character port name, the "iw_cxgb4" ULD and a two digit queue
index. That needs 15 + 1 + 8 + 2 + 1 = 27 bytes, so the old 26 byte buffer
cut the name off before it reached request_irq(). With this patch the full
name shows up in /proc/interrupts.

Could the commit message correct the "%s-Rx%d" arithmetic and mention that
some IRQ names in /proc/interrupts will change?

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261204094816.116-1-chenaibing%40cmss.chinamobile.com