Hi Fenghua, On Thu, 2023-11-30 at 00:31 +0000, Yu, Fenghua wrote: > Hi, Tom, > > > From: Tom Zanussi <tom.zanussi@xxxxxxxxxxxxxxx> > > > > + /* 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