diff options
author | Mihnea Dobrescu-Balaur <mihneadb@gmail.com> | 2013-03-11 06:48:10 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-03-21 05:44:41 -0400 |
commit | 1643a35fea3300c7df63c91596d3246c05b43a76 (patch) | |
tree | 9bc7ddfdafc78cbb642a8c3459afb32e9e88a913 /drivers/crypto/ux500 | |
parent | 5de8875281e1db024d67cbd5c792264194bfca2a (diff) |
crypto: ux500 - replace kmalloc and then memcpy with kmemdup
Signed-off-by: Mihnea Dobrescu-Balaur <mihneadb@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ux500')
-rw-r--r-- | drivers/crypto/ux500/hash/hash_core.c | 4 |
1 files changed, 1 insertions, 3 deletions
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, | |||
1368 | /** | 1368 | /** |
1369 | * Freed in final. | 1369 | * Freed in final. |
1370 | */ | 1370 | */ |
1371 | ctx->key = kmalloc(keylen, GFP_KERNEL); | 1371 | ctx->key = kmemdup(key, keylen, GFP_KERNEL); |
1372 | if (!ctx->key) { | 1372 | if (!ctx->key) { |
1373 | pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key " | 1373 | pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key " |
1374 | "for %d\n", __func__, alg); | 1374 | "for %d\n", __func__, alg); |
1375 | return -ENOMEM; | 1375 | return -ENOMEM; |
1376 | } | 1376 | } |
1377 | |||
1378 | memcpy(ctx->key, key, keylen); | ||
1379 | ctx->keylen = keylen; | 1377 | ctx->keylen = keylen; |
1380 | 1378 | ||
1381 | return ret; | 1379 | return ret; |