Skip to content

Commit

Permalink
crypto: api - Use kzfree
Browse files Browse the repository at this point in the history
Use kzfree() instead of memset() + kfree().

Signed-off-by: Johannes Weiner <[email protected]>
Reviewed-by: Pekka Enberg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
hnaz authored and herbertx committed Jun 2, 2009
1 parent 376bacb commit 811d8f0
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions crypto/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,20 +580,17 @@ EXPORT_SYMBOL_GPL(crypto_alloc_tfm);
void crypto_destroy_tfm(void *mem, struct crypto_tfm *tfm)
{
struct crypto_alg *alg;
int size;

if (unlikely(!mem))
return;

alg = tfm->__crt_alg;
size = ksize(mem);

if (!tfm->exit && alg->cra_exit)
alg->cra_exit(tfm);
crypto_exit_ops(tfm);
crypto_mod_put(alg);
memset(mem, 0, size);
kfree(mem);
kzfree(mem);
}
EXPORT_SYMBOL_GPL(crypto_destroy_tfm);

Expand Down

0 comments on commit 811d8f0

Please sign in to comment.