Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Thorsten Blum and committed by
Vinod Koul
847164d4 7a430af7

+2 -4
+2 -4
drivers/dma/idxd/defaults.c
··· 36 36 group->num_wqs++; 37 37 38 38 /* 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"); 41 40 42 41 /* 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"); 45 43 46 44 engine = idxd->engines[0]; 47 45