lkml.org 
[lkml]   [2019]   [Sep]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RESENT PATCH net-next] ixgbe: Use memzero_explicit directly in crypto cases
Date
In general, Use kzfree() to replace memset() + kfree() is feasible and
resonable. But It's better to use memzero_explicit() to replace memset()
in crypto cases.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index 113f608..7e4f32f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -960,9 +960,11 @@ int ixgbe_ipsec_vf_add_sa(struct ixgbe_adapter *adapter, u32 *msgbuf, u32 vf)
return 0;

err_aead:
- kzfree(xs->aead);
+ memzero_explicit(xs->aead, sizeof(*xs->aead));
+ kfree(xs->aead);
err_xs:
- kzfree(xs);
+ memzero_explicit(xs, sizeof(*xs));
+ kfree(xs);
err_out:
msgbuf[1] = err;
return err;
@@ -1047,7 +1049,8 @@ 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 */
- kzfree(xs);
+ memzero_explicit(xs, sizeof(*xs));
+ kfree(xs);

return 0;
}
--
1.7.12.4
\
 
 \ /
  Last update: 2019-09-18 04:42    [W:0.064 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site