Netdev List
 help / color / mirror / Atom feed
* [PATCH net] net: ethernet: ti: netcp: fix queue name buffer size
@ 2026-11-14 10:34 Aibing Chen
  2026-11-21 22:29 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Aibing Chen @ 2026-11-14 10:34 UTC (permalink / raw)
  To: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni
  Cc: netdev, linux-kernel

netcp_txpipe_open() and netcp_setup_navigator_resources() format a queue
or pool name into a 16 byte stack buffer.  The longest of these names is
"rx-fdq-<devname>-<n>": 7 characters of prefix, IFNAMSIZ - 1 (15)
characters of device name, a dash and the queue index, so it needs up to
35 bytes.

Building the driver with W=1 reports a -Wformat-truncation warning for
each snprintf() that formats ndev->name, e.g. for "rx-pool-%s" the
compiler warns that the %s directive may write up to 15 bytes into a
region of size 8.

netcp_txpipe_open() formats dev_name(dev), which is not bounded by
IFNAMSIZ either, so size that buffer the same way.

The names are only used for knav debugfs entries and for dev_dbg() and
dev_err() messages, so nothing changes apart from the names no longer
being cut short.

Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>
---
 drivers/net/ethernet/ti/netcp_core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index f5e093dc9..a746b0348 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -1327,7 +1327,7 @@ int netcp_txpipe_open(struct netcp_tx_pipe *tx_pipe)
 	struct device *dev = tx_pipe->netcp_device->device;
 	struct knav_dma_cfg config;
 	int ret = 0;
-	u8 name[16];
+	u8 name[40];
 
 	memset(&config, 0, sizeof(config));
 	config.direction = DMA_MEM_TO_DEV;
@@ -1584,7 +1584,7 @@ static int netcp_setup_navigator_resources(struct net_device *ndev)
 	struct knav_queue_notify_config notify_cfg;
 	struct knav_dma_cfg config;
 	u32 last_fdq = 0;
-	u8 name[16];
+	u8 name[40];
 	int ret;
 	int i;
 



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

* Re: [PATCH net] net: ethernet: ti: netcp: fix queue name buffer size
  2026-11-14 10:34 [PATCH net] net: ethernet: ti: netcp: fix queue name buffer size Aibing Chen
@ 2026-11-21 22:29 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-11-21 22:29 UTC (permalink / raw)
  To: Aibing Chen
  Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Paolo Abeni, netdev,
	linux-kernel

On Sat, 14 Nov 2026 18:34:52 +0800 Aibing Chen wrote:
> Building the driver with W=1 reports a -Wformat-truncation warning for
> each snprintf() that formats ndev->name, e.g. for "rx-pool-%s" the
> compiler warns that the %s directive may write up to 15 bytes into a
> region of size 8.

I don't see any such warning on gcc 16.2
-- 
pw-bot: reject

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

end of thread, other threads:[~2026-11-21 22:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-14 10:34 [PATCH net] net: ethernet: ti: netcp: fix queue name buffer size Aibing Chen
2026-11-21 22:29 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox