[dpdk-dev] [PATCH 2/2] ethdev: use strlcpy instead of snprintf on initialization
Stephen Hemminger
stephen at networkplumber.org
Thu Feb 28 23:47:54 CET 2019
Don't need to use snprintf for simple name copy.
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
lib/librte_ethdev/rte_ethdev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 95889ed206db..8bd54dcf58c1 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -459,7 +459,7 @@ rte_eth_dev_allocate(const char *name)
}
eth_dev = eth_dev_get(port_id);
- snprintf(eth_dev->data->name, sizeof(eth_dev->data->name), "%s", name);
+ strlcpy(eth_dev->data->name, name, RTE_ETH_NAME_MAX_LEN);
eth_dev->data->port_id = port_id;
eth_dev->data->mtu = ETHER_MTU;
--
2.17.1
More information about the dev
mailing list