Suggested by devtools/cocci/strlcpy-with-header.cocci
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
drivers/event/cnxk/cnxk_eventdev_stats.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
@@ -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) {