Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: chenaibing@cmss.chinamobile.com
Cc: willemdebruijn.kernel@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, kuba@kernel.org
Subject: Re: [PATCH net-next v2 1/2] cxgb4: size the MSI-X interrupt name buffer
Date: Sat, 05 Dec 2026 10:04:38 +0000	[thread overview]
Message-ID: <179646507830.3146.3301012771345266876@kernel.org> (raw)
In-Reply-To: <20261204094816.116-1-chenaibing@cmss.chinamobile.com>

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@intel.com/

> 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

      parent reply	other threads:[~2026-12-05 10:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  9:48 [PATCH net-next v2 1/2] cxgb4: size the MSI-X interrupt name buffer Aibing Chen
2026-12-04  9:48 ` [PATCH net-next v2 2/2] cxgb4: use scnprintf() for fw_version Aibing Chen
2026-12-05 10:04   ` netdev-bot+sashiko
2026-12-05 10:04 ` netdev-bot+sashiko [this message]

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=179646507830.3146.3301012771345266876@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=chenaibing@cmss.chinamobile.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.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