DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] ethdev: report error on name truncation
@ 2019-01-07 14:40 Nithin Kumar Dabilpuram
  2019-01-07 14:47 ` Andrew Rybchenko
                   ` (3 more replies)
  0 siblings, 4 replies; 17+ messages in thread
From: Nithin Kumar Dabilpuram @ 2019-01-07 14:40 UTC (permalink / raw)
  To: Thomas Monjalon, Ferruh Yigit, Andrew Rybchenko
  Cc: dev, Jerin Jacob Kollanukkaran, Nithin Kumar Dabilpuram

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
---
 lib/librte_ethdev/rte_ethdev.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 9d5107d..bd45445 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -3588,9 +3588,17 @@ rte_eth_dma_zone_reserve(const struct rte_eth_dev *dev, const char *ring_name,
 {
 	char z_name[RTE_MEMZONE_NAMESIZE];
 	const struct rte_memzone *mz;
+	int rc;
 
-	snprintf(z_name, sizeof(z_name), "eth_p%d_q%d_%s",
-		 dev->data->port_id, queue_id, ring_name);
+	rc = snprintf(z_name, sizeof(z_name), "%s_%s_%d_%d",
+		      dev->device->driver->name, ring_name,
+		      dev->data->port_id, queue_id);
+
+	if (rc >= RTE_MEMZONE_NAMESIZE) {
+		RTE_LOG(ERR, EAL, "%s(): truncated name\n", __func__);
+		rte_errno = ENAMETOOLONG;
+		return NULL;
+	}
 
 	mz = rte_memzone_lookup(z_name);
 	if (mz)
-- 
2.8.4

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

end of thread, other threads:[~2019-01-17 17:07 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-07 14:40 [dpdk-dev] [PATCH] ethdev: report error on name truncation Nithin Kumar Dabilpuram
2019-01-07 14:47 ` Andrew Rybchenko
2019-01-07 15:53   ` Stephen Hemminger
2019-01-07 16:17     ` Andrew Rybchenko
2019-01-08  6:06   ` [dpdk-dev] [EXT] " Nithin Kumar Dabilpuram
2019-01-07 14:50 ` [dpdk-dev] " Thomas Monjalon
2019-01-08  5:32   ` [dpdk-dev] [EXT] " Nithin Kumar Dabilpuram
2019-01-13 15:38 ` [dpdk-dev] [PATCH v2] " Nithin Kumar Dabilpuram
2019-01-13 19:28   ` Wiles, Keith
2019-01-13 20:02     ` Thomas Monjalon
2019-01-13 20:19       ` Wiles, Keith
2019-01-13 21:21         ` Thomas Monjalon
2019-01-14  7:32           ` Andrew Rybchenko
2019-01-14 14:30   ` Thomas Monjalon
2019-01-17 14:13 ` [dpdk-dev] [PATCH v3] " Nithin Kumar Dabilpuram
2019-01-17 15:38   ` Thomas Monjalon
2019-01-17 17:07     ` Ferruh Yigit

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).