lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5ecf9433-5de7-4e52-b246-bf17d0cea776@intel.com>
Date: Mon, 11 Aug 2025 08:37:02 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: Thorsten Blum <thorsten.blum@...ux.dev>,
 Vinicius Costa Gomes <vinicius.gomes@...el.com>,
 Vinod Koul <vkoul@...nel.org>
Cc: dmaengine@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Replace memset(0) + strscpy() with
 strscpy_pad()



On 8/10/25 3:58 PM, Thorsten Blum wrote:
> 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@...ux.dev>
> ---
>  drivers/dma/idxd/defaults.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/dma/idxd/defaults.c b/drivers/dma/idxd/defaults.c
> index c607ae8dd12c..2bbbcd02a0da 100644
> --- a/drivers/dma/idxd/defaults.c
> +++ b/drivers/dma/idxd/defaults.c
> @@ -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");

Should also supply the max length?

>  
>  	/* 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];
>  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ