git.droids-corp.org
/
dpdk.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
48670ed
)
ethdev: report error on ring name truncation
author
Nithin Dabilpuram
<ndabilpuram@marvell.com>
Thu, 17 Jan 2019 14:13:54 +0000
(14:13 +0000)
committer
Ferruh Yigit
<ferruh.yigit@intel.com>
Fri, 18 Jan 2019 08:47:26 +0000
(09:47 +0100)
Currently this api doesn't report error if name is
truncated and so user is not sure about uniqueness
of name. This change reports error to help user.
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
lib/librte_ethdev/rte_ethdev.c
patch
|
blob
|
history
diff --git
a/lib/librte_ethdev/rte_ethdev.c
b/lib/librte_ethdev/rte_ethdev.c
index
9d5107d
..
0d192a2
100644
(file)
--- a/
lib/librte_ethdev/rte_ethdev.c
+++ b/
lib/librte_ethdev/rte_ethdev.c
@@
-3588,9
+3588,15
@@
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), "eth_p%d_q%d_%s",
+ dev->data->port_id, queue_id, ring_name);
+ if (rc >= RTE_MEMZONE_NAMESIZE) {
+ RTE_ETHDEV_LOG(ERR, "ring name too long\n");
+ rte_errno = ENAMETOOLONG;
+ return NULL;
+ }
mz = rte_memzone_lookup(z_name);
if (mz)