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 09:02:12 -0700 [thread overview]
Message-ID: <34846223-7ab7-46d9-9e8b-4adc2bc59c44@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>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
> ---
> 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");
>
> /* 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];
>
next prev parent reply other threads:[~2025-08-11 16:02 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
2025-08-11 15:57 ` Thorsten Blum
2025-08-11 16:02 ` Dave Jiang [this message]
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=34846223-7ab7-46d9-9e8b-4adc2bc59c44@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox