mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Aibing Chen <chenaibing@cmss.chinamobile.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH net] net: ethernet: ti: netcp: fix queue name buffer size
Date: Sat, 14 Nov 2026 18:34:52 +0800	[thread overview]
Message-ID: <20261114103452.943-1-chenaibing@cmss.chinamobile.com> (raw)

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;
 



             reply	other threads:[~2026-11-14 10:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14 10:34 Aibing Chen [this message]
2026-11-21 22:29 ` Jakub Kicinski

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=20261114103452.943-1-chenaibing@cmss.chinamobile.com \
    --to=chenaibing@cmss.chinamobile.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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®