Hi, > -----Original Message----- > From: Stephen Hemminger <[email protected]> > Sent: Thursday, June 1, 2023 11:01 PM > To: [email protected] > Cc: Stephen Hemminger <[email protected]>; Xu, Rosen > <[email protected]>; Zhang, Tianfei <[email protected]> > Subject: [PATCH 04/25] raw/ifpga: replace snprintf with strlcpy > > Suggested by devtools/cocci/strlcpy-with-header.cocci > > Signed-off-by: Stephen Hemminger <[email protected]> > --- > drivers/raw/ifpga/afu_pmd_core.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/raw/ifpga/afu_pmd_core.c > b/drivers/raw/ifpga/afu_pmd_core.c > index 3ab1f47ac1a4..e969897dbe7d 100644 > --- a/drivers/raw/ifpga/afu_pmd_core.c > +++ b/drivers/raw/ifpga/afu_pmd_core.c > @@ -16,6 +16,7 @@ > #include <rte_malloc.h> > #include <rte_memzone.h> > #include <rte_rawdev_pmd.h> > +#include <rte_string_fns.h> > > #include "afu_pmd_core.h" > > @@ -225,7 +226,7 @@ static int afu_shared_data_alloc(const char *name, > return -EINVAL; > > /* name format is afu_?|??:??.? which is unique */ > - snprintf(mz_name, sizeof(mz_name), "%s", name); > + strlcpy(mz_name, name, sizeof(mz_name)); > > mz = rte_memzone_lookup(mz_name); > if (!mz) { > -- > 2.39.2
Reviewed-by: Rosen Xu <[email protected]>

