summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/caam
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2016-09-15 11:20:09 +0200
committerHerbert Xu <herbert@gondor.apana.org.au>2016-09-22 18:27:39 +0800
commite7a33c4d0a97e80fe059f711621ad7a65b30a64d (patch)
treec29731c1b4b964dbb1298f6c379c956cc0fb7766 /drivers/crypto/caam
parent664f570a9cee51a8c7caef042118abd2b48705b1 (diff)
downloadop-kernel-dev-e7a33c4d0a97e80fe059f711621ad7a65b30a64d.zip
op-kernel-dev-e7a33c4d0a97e80fe059f711621ad7a65b30a64d.tar.gz
crypto: caam - Use kmalloc_array() in ahash_setkey()
* A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kmalloc_array". This issue was detected by using the Coccinelle software. * Replace the specification of a data type by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/caam')
-rw-r--r--drivers/crypto/caam/caamhash.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/crypto/caam/caamhash.c b/drivers/crypto/caam/caamhash.c
index 9d7fc9e..f19df8f 100644
--- a/drivers/crypto/caam/caamhash.c
+++ b/drivers/crypto/caam/caamhash.c
@@ -525,8 +525,9 @@ static int ahash_setkey(struct crypto_ahash *ahash,
#endif
if (keylen > blocksize) {
- hashed_key = kmalloc(sizeof(u8) * digestsize, GFP_KERNEL |
- GFP_DMA);
+ hashed_key = kmalloc_array(digestsize,
+ sizeof(*hashed_key),
+ GFP_KERNEL | GFP_DMA);
if (!hashed_key)
return -ENOMEM;
ret = hash_digest_key(ctx, key, &keylen, hashed_key,
OpenPOWER on IntegriCloud