[PATCH 10/25] event/cnxk: replace snprintf with strlcpy
Stephen Hemminger
stephen at networkplumber.org
Thu Jun 1 17:00:51 CEST 2023
Suggested by devtools/cocci/strlcpy-with-header.cocci
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
drivers/event/cnxk/cnxk_eventdev_stats.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/drivers/event/cnxk/cnxk_eventdev_stats.c b/drivers/event/cnxk/cnxk_eventdev_stats.c
index a8a87a06e43e..e18d24815f81 100644
--- a/drivers/event/cnxk/cnxk_eventdev_stats.c
+++ b/drivers/event/cnxk/cnxk_eventdev_stats.c
@@ -246,15 +246,14 @@ cnxk_sso_xstats_get_names(const struct rte_eventdev *event_dev,
unsigned int i;
for (i = 0; i < CNXK_SSO_NUM_HWS_XSTATS; i++) {
- snprintf(xstats_names_copy[i].name,
- sizeof(xstats_names_copy[i].name), "%s",
- sso_hws_xstats[i].name);
+ strlcpy(xstats_names_copy[i].name, sso_hws_xstats[i].name,
+ sizeof(xstats_names_copy[i].name));
}
for (; i < CNXK_SSO_NUM_XSTATS; i++) {
- snprintf(xstats_names_copy[i].name,
- sizeof(xstats_names_copy[i].name), "%s",
- sso_hwgrp_xstats[i - CNXK_SSO_NUM_HWS_XSTATS].name);
+ strlcpy(xstats_names_copy[i].name,
+ sso_hwgrp_xstats[i - CNXK_SSO_NUM_HWS_XSTATS].name,
+ sizeof(xstats_names_copy[i].name));
}
switch (mode) {
--
2.39.2
More information about the dev
mailing list