[PATCH 05/25] common/cnxk: replace snprint with strlcpy

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


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

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 drivers/common/cnxk/roc_nix_stats.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/common/cnxk/roc_nix_stats.c b/drivers/common/cnxk/roc_nix_stats.c
index 6b5803af8442..b2e1c8cd05ad 100644
--- a/drivers/common/cnxk/roc_nix_stats.c
+++ b/drivers/common/cnxk/roc_nix_stats.c
@@ -16,9 +16,7 @@
 #define NIX_XSTATS_NAME_PRINT(xstats_names, count, xstats, index)              \
 	do {                                                                   \
 		if (xstats_names)                                              \
-			snprintf(xstats_names[count].name,                     \
-				 sizeof(xstats_names[count].name), "%s",       \
-				 xstats[index].name);                          \
+			strlcpy(xstats_names[count].name, xstats[index].name, sizeof(xstats_names[count].name));                          \
 	} while (0)
 
 int
-- 
2.39.2



More information about the dev mailing list