netxen: fix the ring interrupt name buffer
Subsystems (3)
PATCH 1/1 netxen: fix the ring interrupt name buffer
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.
--- 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(-)
drivers/net/ethernet/qlogic/netxen/netxen_nic.h +1 -1
@@ -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 {
drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +2 -1
@@ -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)
Signature · 1 line
2.43.0
This patch was applied to netdev/net-next.git (main) by Dave Miller <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Dave Miller <[email protected]>:
Quoted 8 lines · 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]", withnetdev->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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html