mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aibing Chen <chenaibing@cmss.chinamobile.com>
To: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net-next v2 1/2] cxgb4: size the MSI-X interrupt name buffer
Date: Fri,  4 Dec 2026 17:48:15 +0800	[thread overview]
Message-ID: <20261204094816.116-1-chenaibing@cmss.chinamobile.com> (raw)

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
  "%s-mirrorrxq%d" needs IFNAMSIZ - 1 + 10 + 5 + 1 = 31 bytes
  "%s-%s%d"        needs 2 * (IFNAMSIZ - 1) + 1 + 11 + 1 = 43 bytes

The last one also formats the ULD queue name, which is copied from the
ULD with memcpy(rxq_info->name, uld_info->name, IFNAMSIZ) into a
char[IFNAMSIZ] field, so it can be up to IFNAMSIZ - 1 characters as well.

Because -Wformat-truncation is enabled for W=1 builds and COMPILE_TEST
configurations turn it into an error through CONFIG_WERROR, the driver
does not build today:

  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
    [-Werror=format-truncation=]
  cxgb4_main.c:1356:47: error: '%d' directive output may be truncated
    writing between 1 and 5 bytes into a region of size between 1 and 16
  cxgb4_uld.c:141:38: error: '%s' directive output may be truncated
    writing up to 15 bytes into a region of size between 10 and 25

Size desc[] for the worst case, 2 * IFNAMSIZ + 11 bytes, so that the
size tracks IFNAMSIZ.

Reported-by: kernel test robot <lkp@intel.com>
Link: https://lore.kernel.org/oe-kbuild-all/202604141419.a4vuNBN7-lkp@intel.com/
Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>
---
 drivers/net/ethernet/chelsio/cxgb4/cxgb4.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
index f20f4bc58..fe5f6af9c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
+++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4.h
@@ -1049,7 +1049,7 @@ struct msix_bmap {
 
 struct msix_info {
 	unsigned short vec;
-	char desc[IFNAMSIZ + 10];
+	char desc[2 * IFNAMSIZ + 11];
 	unsigned int idx;
 	cpumask_var_t aff_mask;
 };



             reply	other threads:[~2026-12-04  9:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  9:48 Aibing Chen [this message]
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 ` [PATCH net-next v2 1/2] cxgb4: size the MSI-X interrupt name buffer netdev-bot+sashiko

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=20261204094816.116-1-chenaibing@cmss.chinamobile.com \
    --to=chenaibing@cmss.chinamobile.com \
    --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

all inboxes | Powered by JetHome®