aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/crypto
diff options
context:
space:
mode:
authorFengguang Wu <fengguang.wu@intel.com>2018-02-16 00:40:13 +0800
committerHerbert Xu <herbert@gondor.apana.org.au>2018-02-22 22:17:01 +0800
commit017457061e07852b7173e6a2578c129b49033204 (patch)
tree202e43b2aeef4240f1aecbc7ec23eeedc83a4114 /drivers/crypto
parentcrypto: atmel - Delete error messages for a failed memory allocation in six functions (diff)
downloadlinux-dev-017457061e07852b7173e6a2578c129b49033204.tar.xz
linux-dev-017457061e07852b7173e6a2578c129b49033204.zip
crypto: ccree - fix memdup.cocci warnings
drivers/crypto/ccree/cc_cipher.c:629:15-22: WARNING opportunity for kmemdep Use kmemdup rather than duplicating its implementation Generated by: scripts/coccinelle/api/memdup.cocci Fixes: 63ee04c8b491 ("crypto: ccree - add skcipher support") CC: Gilad Ben-Yossef <gilad@benyossef.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/ccree/cc_cipher.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/crypto/ccree/cc_cipher.c b/drivers/crypto/ccree/cc_cipher.c
index 5760ca9481ea..1aa7c56dbc02 100644
--- a/drivers/crypto/ccree/cc_cipher.c
+++ b/drivers/crypto/ccree/cc_cipher.c
@@ -626,12 +626,11 @@ static int cc_cipher_process(struct skcipher_request *req,
/* The IV we are handed may be allocted from the stack so
* we must copy it to a DMAable buffer before use.
*/
- req_ctx->iv = kmalloc(ivsize, flags);
+ req_ctx->iv = kmemdup(iv, ivsize, flags);
if (!req_ctx->iv) {
rc = -ENOMEM;
goto exit_process;
}
- memcpy(req_ctx->iv, iv, ivsize);
/*For CTS in case of data size aligned to 16 use CBC mode*/
if (((nbytes % AES_BLOCK_SIZE) == 0) &&