summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/amlogic/amlogic-gxl-cipher.c
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-10-29 02:55:23 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2019-11-08 16:00:46 +0100
commitd832a6128558503feb6ab18ac6e2cdefbc32e5a9 (patch)
tree1f2c708e4be6d61ad62d9de78b6ed4280767754d /drivers/crypto/amlogic/amlogic-gxl-cipher.c
parentcrypto: atmel - Fix remaining endianess warnings (diff)
downloadlinux-d832a6128558503feb6ab18ac6e2cdefbc32e5a9.tar.xz
linux-d832a6128558503feb6ab18ac6e2cdefbc32e5a9.zip
crypto: amlogic - Use kmemdup in meson_aes_setkey()
Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Corentin Labbe <clabbe@baylibre.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/amlogic/amlogic-gxl-cipher.c')
-rw-r--r--drivers/crypto/amlogic/amlogic-gxl-cipher.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/crypto/amlogic/amlogic-gxl-cipher.c b/drivers/crypto/amlogic/amlogic-gxl-cipher.c
index e9283ffdbd23..78e776c58705 100644
--- a/drivers/crypto/amlogic/amlogic-gxl-cipher.c
+++ b/drivers/crypto/amlogic/amlogic-gxl-cipher.c
@@ -372,10 +372,9 @@ int meson_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
kfree(op->key);
}
op->keylen = keylen;
- op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA);
+ op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
if (!op->key)
return -ENOMEM;
- memcpy(op->key, key, keylen);
return crypto_sync_skcipher_setkey(op->fallback_tfm, key, keylen);
}