mirror of
https://github.com/torvalds/linux
synced 2024-10-18 17:29:25 +00:00
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>
This commit is contained in:
parent
5de8875281
commit
1643a35fea
|
@ -1368,14 +1368,12 @@ static int hash_setkey(struct crypto_ahash *tfm,
|
||||||
/**
|
/**
|
||||||
* Freed in final.
|
* Freed in final.
|
||||||
*/
|
*/
|
||||||
ctx->key = kmalloc(keylen, GFP_KERNEL);
|
ctx->key = kmemdup(key, keylen, GFP_KERNEL);
|
||||||
if (!ctx->key) {
|
if (!ctx->key) {
|
||||||
pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
|
pr_err(DEV_DBG_NAME " [%s] Failed to allocate ctx->key "
|
||||||
"for %d\n", __func__, alg);
|
"for %d\n", __func__, alg);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(ctx->key, key, keylen);
|
|
||||||
ctx->keylen = keylen;
|
ctx->keylen = keylen;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
Loading…
Reference in a new issue