[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <itx47uifmow4fcovhritufa76pfes4zsor4ttyf2bzzoycugvc@ivv65ci3wrwq>
Date: Thu, 19 Jun 2025 20:10:22 +0200
From: Antoine Tenart <atenart@...nel.org>
To: fourier.thomas@...il.com
Cc: Antoine Tenart <atenart@...nel.org>,
Herbert Xu <herbert@...dor.apana.org.au>, "David S. Miller" <davem@...emloft.net>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: inside-secure: Fix `dma_unmap_sg()` nents value
IMO the patch subject could be improved, to remove the ` and to be more
descriptive. E.g.
"crypto: inside-secure: unmap DMA buffers using the original number of entries"
On Thu, Jun 19, 2025 at 05:28:36PM +0200, fourier.thomas@...il.com wrote:
>
> diff --git a/drivers/crypto/inside-secure/safexcel_hash.c b/drivers/crypto/inside-secure/safexcel_hash.c
> index d2b632193beb..1ef1ccfaaa95 100644
> --- a/drivers/crypto/inside-secure/safexcel_hash.c
> +++ b/drivers/crypto/inside-secure/safexcel_hash.c
> @@ -249,7 +249,10 @@ static int safexcel_handle_req_result(struct safexcel_crypto_priv *priv,
> safexcel_complete(priv, ring);
>
> if (sreq->nents) {
> - dma_unmap_sg(priv->dev, areq->src, sreq->nents, DMA_TO_DEVICE);
> + dma_unmap_sg(priv->dev,
> + areq->src,
> + sg_nents_for_len(areq->src, areq->nbytes),
> + DMA_TO_DEVICE);
No need to put 'areq->src,' on a new line.
> sreq->nents = 0;
> }
>
> @@ -497,7 +500,10 @@ static int safexcel_ahash_send_req(struct crypto_async_request *async, int ring,
> DMA_FROM_DEVICE);
> unmap_sg:
> if (req->nents) {
> - dma_unmap_sg(priv->dev, areq->src, req->nents, DMA_TO_DEVICE);
> + dma_unmap_sg(priv->dev,
> + areq->src,
> + sg_nents_for_len(areq->src, areq->nbytes),
> + DMA_TO_DEVICE);
Same here.
Otherwise this looks good to me. With those fixed, you can add:
Reviewed-by: Antoine Tenart <atenart@...nel.org>
Thanks!
Powered by blists - more mailing lists