From: Mihnea Dobrescu-Balaur Date: Mon, 11 Mar 2013 10:48:10 +0000 (+0200) Subject: crypto: ux500 - replace kmalloc and then memcpy with kmemdup X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=1643a35fea3300c7df63c91596d3246c05b43a76;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git crypto: ux500 - replace kmalloc and then memcpy with kmemdup Signed-off-by: Mihnea Dobrescu-Balaur Signed-off-by: Herbert Xu --- diff --git a/drivers/crypto/ux500/hash/hash_core.c b/drivers/crypto/ux500/hash/hash_core.c index 632c3339895f..8d16d3aa7650 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;