mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
crypto: api - Use kzfree
Use kzfree() instead of memset() + kfree(). Signed-off-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Pekka Enberg <penberg@cs.helsinki.fi> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
376bacb0a2
commit
811d8f0626
1 changed files with 1 additions and 4 deletions
|
@ -580,20 +580,17 @@ EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
|
||||||
void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
|
void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
|
||||||
{
|
{
|
||||||
struct crypto_alg *alg;
|
struct crypto_alg *alg;
|
||||||
int size;
|
|
||||||
|
|
||||||
if (unlikely(!mem))
|
if (unlikely(!mem))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
alg = tfm->__crt_alg;
|
alg = tfm->__crt_alg;
|
||||||
size = ksize(mem);
|
|
||||||
|
|
||||||
if (!tfm->exit && alg->cra_exit)
|
if (!tfm->exit && alg->cra_exit)
|
||||||
alg->cra_exit(tfm);
|
alg->cra_exit(tfm);
|
||||||
crypto_exit_ops(tfm);
|
crypto_exit_ops(tfm);
|
||||||
crypto_mod_put(alg);
|
crypto_mod_put(alg);
|
||||||
memset(mem, 0, size);
|
kzfree(mem);
|
||||||
kfree(mem);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(crypto_destroy_tfm);
|
EXPORT_SYMBOL_GPL(crypto_destroy_tfm);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue