]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export
authorThorsten Blum <thorsten.blum@linux.dev>
Tue, 17 Mar 2026 16:52:57 +0000 (17:52 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 27 Mar 2026 09:52:25 +0000 (18:52 +0900)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/marvell/cesa/hash.c

index 5103d36cdfdb1a0c79e332abb06c13426820a80a..2f203042d9bdad9fa628fbed450e57af8dd3b5c4 100644 (file)
@@ -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;
 }