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

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

Checks

Context Check Description
ci/checkpatch warning coding style issues

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/common/cnxk/roc_nix_stats.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
  

Patch

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