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

Message ID 20230601150106.18375-15-stephen@networkplumber.org (mailing list archive)
State Rejected, archived
Delegated to: Thomas Monjalon
Headers
Series replace snprintf with strlcpy |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger June 1, 2023, 3 p.m. UTC
  Suggested by devtools/cocci/strlcpy-with-header.cocci

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

Patch

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;