Skip to contentSkip to conversation

crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export

PATCH In review Thorsten Blum 2 participants 2 messages Mar 17 – Mar 27

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: marvell/cesa - use memcpy_and_pad in mv_cesa_ahash_export

Replace memset() followed by memcpy() with memcpy_and_pad() to simplify the code and to write to 'cache' only once.

---
 drivers/crypto/marvell/cesa/hash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/crypto/marvell/cesa/hash.c +1 -2
index 5103d36cdfdb..2f203042d9bd 100644
@@ -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;
 }
maintainer
#1 lore raw
Quoted 7 lines · Thorsten Blum

Replace memset() followed by memcpy() with memcpy_and_pad() to simplify the code and to write to 'cache' only once.

---
 drivers/crypto/marvell/cesa/hash.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Patch applied. Thanks.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt