<...>
> > -----Original Message-----
> > From: Daly, Lee
> > Sent: Tuesday, April 17, 2018 2:35 PM
> > To: [email protected]
> > Cc: De Lara Guarch, Pablo <[email protected]>; Tucker,
> > Greg B <[email protected]>; Jain, Deepak K
> > <[email protected]>; Trahe, Fiona <[email protected]>; Daly,
> > Lee <[email protected]>
> > Subject: [PATCH v3 05/11] compress/isal: add queue pair related ops
> >
> > Signed-off-by: Lee Daly <[email protected]>
> > ---
> > drivers/compress/isal/isal_compress_pmd_ops.c | 110
> > +++++++++++++++++++++-
> > drivers/compress/isal/isal_compress_pmd_private.h | 2 +
> > 2 files changed, 110 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/compress/isal/isal_compress_pmd_ops.c
> > b/drivers/compress/isal/isal_compress_pmd_ops.c
> > index 2e9381d..73e4c84 100644
> > --- a/drivers/compress/isal/isal_compress_pmd_ops.c
//snip
>
> > +qp_id */ static int isal_comp_pmd_qp_set_unique_name(struct
> > +rte_compressdev *dev, struct isal_comp_qp *qp) {
> > + unsigned int n = snprintf(qp->name, sizeof(qp->name),
> > + "isal_compression_pmd_%u_qp_%u",
> > + dev->data->dev_id, qp->id);
>
> Better to use strlcpy.
[Lee] I believe snprintf to be a better fit due to the fact strlcpy doesn't
handle variable arguments as inputs, i.e
"snprintf(dst, length, "%s", src)"
"strlcpy(dst, src, length)"
To complete this action with strlcpy would cause more overhead, and snprintf()
is still safe as it always null terminates.
>
> > +
> > + if (n >= sizeof(qp->name))
> > + return -1;
> > +
> > + return 0;
> > +}