mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] crypto: replace kmalloc and then memcpy with kmemdup
@ 2013-03-11 10:48 Mihnea Dobrescu-Balaur
  2013-03-21  9:54 ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Mihnea Dobrescu-Balaur @ 2013-03-11 10:48 UTC (permalink / raw)
  To: linux-crypto
  Cc: herbert, davem, linus.walleij, andreas.westin, arnd, rubini,
	linux-kernel, Mihnea Dobrescu-Balaur

Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
---
 drivers/crypto/ux500/hash/hash_core.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c
index 632c333..8d16d3a 100644
--- a/drivers/crypto/ux500/hash/hash_core.c
+++ b/drivers/crypto/ux500/hash/hash_core.c
@@ -1368,14 +1368,12 @@ static int hash_setkey(struct crypto_ahash *tfm,
 	/**
 	 * Freed in final.
 	 */
-	ctx->key = kmalloc(keylen, GFP_KERNEL);
+	ctx->key = kmemdup(key, keylen, GFP_KERNEL);
 	if (!ctx->key) {
 		pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
 		       "for %d\n", __func__, alg);
 		return -ENOMEM;
 	}
-
-	memcpy(ctx->key, key, keylen);
 	ctx->keylen = keylen;
 
 	return ret;
-- 
1.7.10.4


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

end of thread, other threads:[~2013-03-21 18:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-11 10:48 [PATCH] crypto: replace kmalloc and then memcpy with kmemdup Mihnea Dobrescu-Balaur
2013-03-21  9:54 ` Herbert Xu
2013-03-21 18:18   ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®