Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by xujiahao
Fri, 06 Nov 2026 09:51
[PATCH net-next] netxen: fix the ring interrupt name buffer
Author: xujiahao
Date: Fri, 06 Nov 2026 09:51
Date: Fri, 06 Nov 2026 09:51
46 lines
10381 bytes
10381 bytes
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
Re: [PATCH net-next] netxen: fix the ring interrupt name buffer
Author: patchwork-bot+netdevbpf
Date: Wed, 11 Nov 2026 08:10
Date: Wed, 11 Nov 2026 08:10
24 lines
8847 bytes
8847 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads