summaryrefslogtreecommitdiff
path: root/drivers/crypto/amlogic
diff options
context:
space:
mode:
authorYueHaibing <yuehaibing@huawei.com>2019-10-29 01:55:23 +0000
committerHerbert Xu <herbert@gondor.apana.org.au>2019-11-08 23:00:46 +0800
commitd832a6128558503feb6ab18ac6e2cdefbc32e5a9 (patch)
tree1f2c708e4be6d61ad62d9de78b6ed4280767754d /drivers/crypto/amlogic
parent427e6e3ad98ce17dae2ef61f56664c7b97745320 (diff)
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')
-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);
}