crypto: sun8i-ce - Fix memdup.cocci warnings
Use kmemdup rather than duplicating its implementation Signed-off-by: YueHaibing <yuehaibing@huawei.com> Acked-by: Corentin Labbe <clabbe.montjoie@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
d6e9da21ee
commit
c7351845b2
@ -396,10 +396,9 @@ int sun8i_ce_aes_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|||||||
kfree(op->key);
|
kfree(op->key);
|
||||||
}
|
}
|
||||||
op->keylen = keylen;
|
op->keylen = keylen;
|
||||||
op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA);
|
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
|
||||||
if (!op->key)
|
if (!op->key)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(op->key, key, keylen);
|
|
||||||
|
|
||||||
crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
|
crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
|
||||||
crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
|
crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
|
||||||
@ -422,10 +421,9 @@ int sun8i_ce_des3_setkey(struct crypto_skcipher *tfm, const u8 *key,
|
|||||||
kfree(op->key);
|
kfree(op->key);
|
||||||
}
|
}
|
||||||
op->keylen = keylen;
|
op->keylen = keylen;
|
||||||
op->key = kmalloc(keylen, GFP_KERNEL | GFP_DMA);
|
op->key = kmemdup(key, keylen, GFP_KERNEL | GFP_DMA);
|
||||||
if (!op->key)
|
if (!op->key)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
memcpy(op->key, key, keylen);
|
|
||||||
|
|
||||||
crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
|
crypto_sync_skcipher_clear_flags(op->fallback_tfm, CRYPTO_TFM_REQ_MASK);
|
||||||
crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
|
crypto_sync_skcipher_set_flags(op->fallback_tfm, tfm->base.crt_flags & CRYPTO_TFM_REQ_MASK);
|
||||||
|
Loading…
Reference in New Issue
Block a user