Skip to content

Commit 847164d

Browse files
tobluxvinodkoul
authored andcommitted
dmaengine: idxd: Replace memset(0) + strscpy() with strscpy_pad()
Replace memset(0) followed by strscpy() with strscpy_pad() to improve idxd_load_iaa_device_defaults(). This avoids zeroing the memory before copying the strings and ensures the destination buffers are only written to once, simplifying the code and improving efficiency. Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev> Reviewed-by: Dave Jiang <dave.jiang@intel.com> Link: https://lore.kernel.org/r/20250810225858.2953-2-thorsten.blum@linux.dev Signed-off-by: Vinod Koul <vkoul@kernel.org>
1 parent 7a430af commit 847164d

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

drivers/dma/idxd/defaults.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,10 @@ int idxd_load_iaa_device_defaults(struct idxd_device *idxd)
3636
group->num_wqs++;
3737

3838
/* set name to "iaa_crypto" */
39-
memset(wq->name, 0, WQ_NAME_SIZE + 1);
40-
strscpy(wq->name, "iaa_crypto", WQ_NAME_SIZE + 1);
39+
strscpy_pad(wq->name, "iaa_crypto");
4140

4241
/* set driver_name to "crypto" */
43-
memset(wq->driver_name, 0, DRIVER_NAME_SIZE + 1);
44-
strscpy(wq->driver_name, "crypto", DRIVER_NAME_SIZE + 1);
42+
strscpy_pad(wq->driver_name, "crypto");
4543

4644
engine = idxd->engines[0];
4745

0 commit comments

Comments
 (0)