patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH] examples/ethtool: fix buffer size for pkt pool name
@ 2025-12-03 11:01 Shani Peretz
  0 siblings, 0 replies; only message in thread
From: Shani Peretz @ 2025-12-03 11:01 UTC (permalink / raw)
  To: dev; +Cc: Shani Peretz, stable, Remy Horton

Increase str_name buffer size from 16 to 32 bytes to fit the provided
format. The previous size was insufficient as the format
string "pkt_pool%i" can produce up to 19 bytes (8 for "pkt_pool",
up to 10 for integer value, and 1 for null terminator).

Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
Cc: stable@dpdk.org

Signed-off-by: Shani Peretz <shperetz@nvidia.com>
---
 examples/ethtool/ethtool-app/main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/examples/ethtool/ethtool-app/main.c b/examples/ethtool/ethtool-app/main.c
index 1f011a9321..06605b4202 100644
--- a/examples/ethtool/ethtool-app/main.c
+++ b/examples/ethtool/ethtool-app/main.c
@@ -92,7 +92,7 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
 	int size_pktpool;
 	struct rte_eth_conf cfg_port;
 	struct rte_eth_dev_info dev_info;
-	char str_name[16];
+	char str_name[32];
 	uint16_t nb_rxd = PORT_RX_QUEUE_SIZE;
 	uint16_t nb_txd = PORT_TX_QUEUE_SIZE;
 	int ret;
@@ -112,7 +112,7 @@ static void setup_ports(struct app_config *app_cfg, int cnt_ports)
 		size_pktpool = dev_info.rx_desc_lim.nb_max +
 			dev_info.tx_desc_lim.nb_max + PKTPOOL_EXTRA_SIZE;
 
-		snprintf(str_name, 16, "pkt_pool%i", idx_port);
+		snprintf(str_name, sizeof(str_name), "pkt_pool%i", idx_port);
 		ptr_port->pkt_pool = rte_pktmbuf_pool_create(
 			str_name,
 			size_pktpool, PKTPOOL_CACHE,
-- 
2.34.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-12-03 11:02 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-03 11:01 [PATCH] examples/ethtool: fix buffer size for pkt pool name Shani Peretz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).