Commit 09ea989e authored by David S. Miller's avatar David S. Miller

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: default avatarDavid S. Miller <davem@davemloft.net>
parents b06b3992 da3a3b65
...@@ -960,11 +960,9 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) ...@@ -960,11 +960,9 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
return 0; return 0;
err_aead: err_aead:
memset(xs->aead, 0, sizeof(*xs->aead)); kzfree(xs->aead);
kfree(xs->aead);
err_xs: err_xs:
memset(xs, 0, sizeof(*xs)); kzfree(xs);
kfree(xs);
err_out: err_out:
msgbuf[1] = err; msgbuf[1] = err;
return err; return err;
...@@ -1049,8 +1047,7 @@ int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf) ...@@ -1049,8 +1047,7 @@ int ixgbe_ipsec_vf_del_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
ixgbe_ipsec_del_sa(xs); ixgbe_ipsec_del_sa(xs);
/* remove the xs that was made-up in the add request */ /* remove the xs that was made-up in the add request */
memset(xs, 0, sizeof(*xs)); kzfree(xs);
kfree(xs);
return 0; return 0;
} }
......
...@@ -180,8 +180,7 @@ static int cache_hit(in_cache_entry *entry, struct mpoa_client *mpc) ...@@ -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) static void in_cache_put(in_cache_entry *entry)
{ {
if (refcount_dec_and_test(&entry->use)) { if (refcount_dec_and_test(&entry->use)) {
memset(entry, 0, sizeof(in_cache_entry)); kzfree(entry);
kfree(entry);
} }
} }
...@@ -416,8 +415,7 @@ static eg_cache_entry *eg_cache_get_by_src_ip(__be32 ipaddr, ...@@ -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) static void eg_cache_put(eg_cache_entry *entry)
{ {
if (refcount_dec_and_test(&entry->use)) { if (refcount_dec_and_test(&entry->use)) {
memset(entry, 0, sizeof(eg_cache_entry)); kzfree(entry);
kfree(entry);
} }
} }
......
...@@ -228,14 +228,11 @@ u32 krb5_derive_key(const struct gss_krb5_enctype *gk5e, ...@@ -228,14 +228,11 @@ u32 krb5_derive_key(const struct gss_krb5_enctype *gk5e,
ret = 0; ret = 0;
err_free_raw: err_free_raw:
memset(rawkey, 0, keybytes); kzfree(rawkey);
kfree(rawkey);
err_free_out: err_free_out:
memset(outblockdata, 0, blocksize); kzfree(outblockdata);
kfree(outblockdata);
err_free_in: err_free_in:
memset(inblockdata, 0, blocksize); kzfree(inblockdata);
kfree(inblockdata);
err_free_cipher: err_free_cipher:
crypto_free_sync_skcipher(cipher); crypto_free_sync_skcipher(cipher);
err_return: err_return:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment