[PATCH 14/25] net/cpfl: replace snprintf with strlcpy

Stephen Hemminger stephen at networkplumber.org
Thu Jun 1 17:00:55 CEST 2023


Suggested by devtools/cocci/strlcpy-with-header.cocci

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/net/cpfl/cpfl_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/cpfl/cpfl_ethdev.c b/drivers/net/cpfl/cpfl_ethdev.c
index ede730fd508b..7aed8c878ee6 100644
--- a/drivers/net/cpfl/cpfl_ethdev.c
+++ b/drivers/net/cpfl/cpfl_ethdev.c
@@ -380,9 +380,9 @@ static int cpfl_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 
 	if (xstats_names) {
 		for (i = 0; i < CPFL_NB_XSTATS; i++) {
-			snprintf(xstats_names[i].name,
-				 sizeof(xstats_names[i].name),
-				 "%s", rte_cpfl_stats_strings[i].name);
+			strlcpy(xstats_names[i].name,
+				rte_cpfl_stats_strings[i].name,
+				sizeof(xstats_names[i].name));
 		}
 	}
 	return CPFL_NB_XSTATS;
-- 
2.39.2



More information about the dev mailing list