All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] crypto: amlogic - Use kmemdup in meson_aes_setkey()
@ 2019-10-29  1:55 ` YueHaibing
  0 siblings, 0 replies; 6+ messages in thread
From: YueHaibing @ 2019-10-29  1:55 UTC (permalink / raw)
  To: Corentin Labbe, Herbert Xu
  Cc: YueHaibing, linux-crypto, linux-kernel, kernel-janitors

Use kmemdup rather than duplicating its implementation

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
 drivers/crypto/amlogic/amlogic-gxl-cipher.c | 3 +--
 1 file changed, 1 insertion(+), 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);
 }

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-08 15:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-10-29  1:55 [PATCH -next] crypto: amlogic - Use kmemdup in meson_aes_setkey() YueHaibing
2019-10-29  1:55 ` YueHaibing
2019-10-29 12:42 ` LABBE Corentin
2019-10-29 12:42   ` LABBE Corentin
2019-11-08 15:11 ` Herbert Xu
2019-11-08 15:11   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.