mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net-next] netxen: fix the ring interrupt name buffer
@ 2026-11-06  9:51 xujiahao
  2026-11-11  8:10 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: xujiahao @ 2026-11-06  9:51 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni
  Cc: Manish Chopra, Rahul Verma, GR-Linux-NIC-Dev, Andrew Lunn,
	netdev, linux-kernel, xujiahao

The receive ring interrupt names are assembled with sprintf() into
IFNAMSIZ + 4 byte buffers as "%s[%d]", with netdev->name (up to
IFNAMSIZ - 1 characters) and the ring index.  A 15-character name plus
"[" and a full-range %d needs 28 bytes, so gcc reports in a W=1 build:

  drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c:1052:45: warning: '%d' directive writing between 1 and 11 bytes into a region of size between 4 and 19 [-Wformat-overflow=]

Enlarge the buffer so the worst case fits and switch to snprintf() so
that the write can never exceed it either way.

Signed-off-by: xujiahao <xujiahao@cmss.chinamobile.com>
---
 drivers/net/ethernet/qlogic/netxen/netxen_nic.h      | 2 +-
 drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
index 3d36d23df..1b924b2d5 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic.h
@@ -634,7 +634,7 @@ struct nx_host_sds_ring {
 	int irq;
 
 	dma_addr_t phys_addr;
-	char name[IFNAMSIZ+4];
+	char name[IFNAMSIZ + 16];
 };
 
 struct nx_host_tx_ring {
diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
index 67d9bf69f..cffa93a98 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c
@@ -1049,7 +1049,8 @@ netxen_nic_request_irq(struct netxen_adapter *adapter)
 
 	for (ring = 0; ring < adapter->max_sds_rings; ring++) {
 		sds_ring = &recv_ctx->sds_rings[ring];
-		sprintf(sds_ring->name, "%s[%d]", netdev->name, ring);
+		snprintf(sds_ring->name, sizeof(sds_ring->name),
+			 "%s[%d]", netdev->name, ring);
 		err = request_irq(sds_ring->irq, handler,
 				  flags, sds_ring->name, sds_ring);
 		if (err)
-- 
2.43.0




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] netxen: fix the ring interrupt name buffer
  2026-11-06  9:51 [PATCH net-next] netxen: fix the ring interrupt name buffer xujiahao
@ 2026-11-11  8:10 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-11  8:10 UTC (permalink / raw)
  To: Jiahao Xu
  Cc: davem, edumazet, kuba, pabeni, manishc, rahulv, GR-Linux-NIC-Dev,
	andrew+netdev, netdev, linux-kernel

Hello:

This patch was applied to netdev/net-next.git (main)
by Dave Miller <davem@davem-thinkpadp1gen8.ibmlond.csb>:

On Fri,  6 Nov 2026 17:51:15 +0800 you wrote:
> The receive ring interrupt names are assembled with sprintf() into
> IFNAMSIZ + 4 byte buffers as "%s[%d]", with netdev->name (up to
> IFNAMSIZ - 1 characters) and the ring index.  A 15-character name plus
> "[" and a full-range %d needs 28 bytes, so gcc reports in a W=1 build:
> 
>   drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c:1052:45: warning: '%d' directive writing between 1 and 11 bytes into a region of size between 4 and 19 [-Wformat-overflow=]
> 
> [...]

Here is the summary with links:
  - [net-next] netxen: fix the ring interrupt name buffer
    https://git.kernel.org/netdev/net-next/c/c40c6c365183

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-11  8:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-06  9:51 [PATCH net-next] netxen: fix the ring interrupt name buffer xujiahao
2026-11-11  8:10 ` patchwork-bot+netdevbpf

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®