[PATCH] crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export

Thorsten Blum posted 1 patch 2 weeks, 6 days ago
drivers/crypto/marvell/cesa/hash.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
[PATCH] crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export
Posted by Thorsten Blum 2 weeks, 6 days ago
Replace memset() followed by memcpy() with memcpy_and_pad() to simplify
the code and to write to 'cache' only once.

Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 drivers/crypto/marvell/cesa/hash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/crypto/marvell/cesa/hash.c b/drivers/crypto/marvell/cesa/hash.c
index 5103d36cdfdb..2f203042d9bd 100644
--- a/drivers/crypto/marvell/cesa/hash.c
+++ b/drivers/crypto/marvell/cesa/hash.c
@@ -847,8 +847,7 @@ static int mv_cesa_ahash_export(struct ahash_request *req, void *hash,
 
 	*len = creq->len;
 	memcpy(hash, creq->state, digsize);
-	memset(cache, 0, blocksize);
-	memcpy(cache, creq->cache, creq->cache_ptr);
+	memcpy_and_pad(cache, blocksize, creq->cache, creq->cache_ptr, 0);
 
 	return 0;
 }
Re: [PATCH] crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export
Posted by Herbert Xu 1 week, 3 days ago
On Tue, Mar 17, 2026 at 05:52:57PM +0100, Thorsten Blum wrote:
> Replace memset() followed by memcpy() with memcpy_and_pad() to simplify
> the code and to write to 'cache' only once.
> 
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  drivers/crypto/marvell/cesa/hash.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt