Merge branch 'net-kzfree'

zhong jiang says:

====================
net: Use kzfree() directly

With the help of Coccinelle. We find some place to replace.

@@
expression M, S;
@@

- memset(M, 0, S);
- kfree(M);
+ kzfree(M);
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2019-09-05 12:06:04 +02:00
commit 09ea989e2b
3 changed files with 8 additions and 16 deletions

View File

@ -960,11 +960,9 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
return 0;
err_aead:
memset(xs->aead, 0, sizeof(*xs->aead));
kfree(xs->aead);
kzfree(xs->aead);
err_xs:
memset(xs, 0, sizeof(*xs));
kfree(xs);
kzfree(xs);
err_out:
msgbuf[1] = err;
return err;
@ -1049,8 +1047,7 @@ int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
ixgbe_ipsec_del_sa(xs);
/* remove the xs that was made-up in the add request */
memset(xs, 0, sizeof(*xs));
kfree(xs);
kzfree(xs);
return 0;
}

View File

@ -180,8 +180,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc)
static void in_cache_put(in_cache_entry *entry)
{
if (refcount_dec_and_test(&entry->use)) {
memset(entry, 0, sizeof(in_cache_entry));
kfree(entry);
kzfree(entry);
}
}
@ -416,8 +415,7 @@ static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr,
static void eg_cache_put(eg_cache_entry *entry)
{
if (refcount_dec_and_test(&entry->use)) {
memset(entry, 0, sizeof(eg_cache_entry));
kfree(entry);
kzfree(entry);
}
}

View File

@ -228,14 +228,11 @@ u32 krb5_derive_key(const struct gss_krb5_enctype *gk5e,
ret = 0;
err_free_raw:
memset(rawkey, 0, keybytes);
kfree(rawkey);
kzfree(rawkey);
err_free_out:
memset(outblockdata, 0, blocksize);
kfree(outblockdata);
kzfree(outblockdata);
err_free_in:
memset(inblockdata, 0, blocksize);
kfree(inblockdata);
kzfree(inblockdata);
err_free_cipher:
crypto_free_sync_skcipher(cipher);
err_return: