[12/25] net/axgbe: replace snprintf with strlcpy

Message ID 20230601150106.18375-13-stephen@networkplumber.org (mailing list archive)
State Rejected
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/axgbe/axgbe_ethdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index 48714eebe699..f28d18ec9035 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -1025,9 +1025,9 @@  axgbe_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
 
 	if (n >= AXGBE_XSTATS_COUNT && xstats_names) {
 		for (i = 0; i < AXGBE_XSTATS_COUNT; ++i) {
-			snprintf(xstats_names[i].name,
-				 RTE_ETH_XSTATS_NAME_SIZE, "%s",
-				 axgbe_xstats_strings[i].name);
+			strlcpy(xstats_names[i].name,
+				axgbe_xstats_strings[i].name,
+				RTE_ETH_XSTATS_NAME_SIZE);
 		}
 	}