[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <29ea34917cbfabf2b98b4957b7770683f5994873.camel@linux.intel.com>
Date: Thu, 30 Nov 2023 09:18:17 -0600
From: Tom Zanussi <tom.zanussi@...ux.intel.com>
To: "Yu, Fenghua" <fenghua.yu@...el.com>,
"herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
"davem@...emloft.net" <davem@...emloft.net>,
"vkoul@...nel.org" <vkoul@...nel.org>
Cc: "Jiang, Dave" <dave.jiang@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"Feghali, Wajdi K" <wajdi.k.feghali@...el.com>,
"Guilford, James" <james.guilford@...el.com>,
"Sridhar, Kanchana P" <kanchana.p.sridhar@...el.com>,
"Gopal, Vinodh" <vinodh.gopal@...el.com>,
"Cabiddu, Giovanni" <giovanni.cabiddu@...el.com>,
"pavel@....cz" <pavel@....cz>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"dmaengine@...r.kernel.org" <dmaengine@...r.kernel.org>
Subject: Re: [PATCH v10 14/14] dmaengine: idxd: Add support for device/wq
defaults
Hi Fenghua,
On Thu, 2023-11-30 at 00:31 +0000, Yu, Fenghua wrote:
> Hi, Tom,
>
> > From: Tom Zanussi <tom.zanussi@...ux.intel.com>
> > > > + /* set name to "iaa_crypto" */
> > > > + memset(wq->name, 0, WQ_NAME_SIZE + 1);
> > > > + strscpy(wq->name, "iaa_crypto", WQ_NAME_SIZE + 1);
> > >
> > > Is strcpy(wq->name, "iaa_crypto") simpler than memset() and
> > > strscpy()?
> >
> > That's what I originally had, but checkpatch complained about it,
> > suggesting
> > strscpy, so I changed it to make checkpatch happy.
>
> Why is size WQ_NAME_SIZE+1 instead of WQ_NAME_SIZE? Will
> WQ_NAME_SIZE+1 cause mem corruption because wq->name is defined as a
> string with WQ_NAME_SIZE?
No, wq->name actually is:
char name[WQ_NAME_SIZE + 1];
This code is doing the same thing as elsewhere in the idxd driver
except instead of sprintf() it uses strscpy().
> >
> > >
> > > > +
> > > > + /* set driver_name to "crypto" */
> > > > + memset(wq->driver_name, 0, DRIVER_NAME_SIZE + 1);
> > > > + strscpy(wq->driver_name, "crypto", DRIVER_NAME_SIZE +
> > > > 1);
> > >
> > > Is strcpy(wq->driver_name, "crypto") simpler?
> >
> > Same here.
>
> Ditto.
>
Same.
Tom
> Thanks.
>
> -Fenghua
Powered by blists - more mailing lists