Commit 847164d4 authored by Thorsten Blum's avatar Thorsten Blum Committed by Vinod Koul
Browse files

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: default avatarThorsten Blum <thorsten.blum@linux.dev>
Reviewed-by: default avatarDave Jiang <dave.jiang@intel.com>
Link: https://lore.kernel.org/r/20250810225858.2953-2-thorsten.blum@linux.dev


Signed-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 7a430af7
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -36,12 +36,10 @@ int idxd_load_iaa_device_defaults(struct idxd_device *idxd)
	group->num_wqs++;

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

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

	engine = idxd->engines[0];