All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Thorsten Blum <thorsten.blum@linux.dev>,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>,
	Vinod Koul <vkoul@kernel.org>
Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Replace memset(0) + strscpy() with strscpy_pad()
Date: Mon, 11 Aug 2025 08:37:02 -0700	[thread overview]
Message-ID: <5ecf9433-5de7-4e52-b246-bf17d0cea776@intel.com> (raw)
In-Reply-To: <20250810225858.2953-2-thorsten.blum@linux.dev>



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@linux.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];
>  


  reply	other threads:[~2025-08-11 15:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-10 22:58 [PATCH] dmaengine: idxd: Replace memset(0) + strscpy() with strscpy_pad() Thorsten Blum
2025-08-11 15:37 ` Dave Jiang [this message]
2025-08-11 15:57   ` Thorsten Blum
2025-08-11 16:02 ` Dave Jiang
2025-08-20 17:42 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ecf9433-5de7-4e52-b246-bf17d0cea776@intel.com \
    --to=dave.jiang@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=thorsten.blum@linux.dev \
    --cc=vinicius.gomes@intel.com \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.