From: Danylo Vodopianov <dvo-...@napatech.com>

Calling memset before free() has no effect and will be flagged
by security parsing tools as a potential bug. None of these data
structures have sensitive information.

Signed-off-by: Danylo Vodopianov <dvo-...@napatech.com>
---
 drivers/net/ntnic/nthw/core/nthw_hif.c         | 5 +----
 drivers/net/ntnic/nthw/core/nthw_iic.c         | 5 +----
 drivers/net/ntnic/nthw/core/nthw_pcie3.c       | 5 +----
 drivers/net/ntnic/nthw/core/nthw_rpf.c         | 5 +----
 drivers/net/ntnic/nthw/core/nthw_sdc.c         | 5 +----
 drivers/net/ntnic/nthw/core/nthw_si5340.c      | 5 +----
 drivers/net/ntnic/nthw/model/nthw_fpga_model.c | 1 -
 7 files changed, 6 insertions(+), 25 deletions(-)

diff --git a/drivers/net/ntnic/nthw/core/nthw_hif.c 
b/drivers/net/ntnic/nthw/core/nthw_hif.c
index ddb875f625..f2d6f372b0 100644
--- a/drivers/net/ntnic/nthw/core/nthw_hif.c
+++ b/drivers/net/ntnic/nthw/core/nthw_hif.c
@@ -23,10 +23,7 @@ nthw_hif_t *nthw_hif_new(void)
 
 void nthw_hif_delete(nthw_hif_t *p)
 {
-       if (p) {
-               memset(p, 0, sizeof(nthw_hif_t));
-               free(p);
-       }
+       free(p);
 }
 
 int nthw_hif_init(nthw_hif_t *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/core/nthw_iic.c 
b/drivers/net/ntnic/nthw/core/nthw_iic.c
index f84eb7eeb2..a96d878f25 100644
--- a/drivers/net/ntnic/nthw/core/nthw_iic.c
+++ b/drivers/net/ntnic/nthw/core/nthw_iic.c
@@ -253,10 +253,7 @@ int nthw_iic_init(nthw_iic_t *p, nthw_fpga_t *p_fpga, int 
n_iic_instance,
 
 void nthw_iic_delete(nthw_iic_t *p)
 {
-       if (p) {
-               memset(p, 0, sizeof(nthw_iic_t));
-               free(p);
-       }
+       free(p);
 }
 
 int nthw_iic_set_retry_params(nthw_iic_t *p, const int n_poll_delay, const int 
n_bus_ready_retry,
diff --git a/drivers/net/ntnic/nthw/core/nthw_pcie3.c 
b/drivers/net/ntnic/nthw/core/nthw_pcie3.c
index 5928f81629..bad1c31e35 100644
--- a/drivers/net/ntnic/nthw/core/nthw_pcie3.c
+++ b/drivers/net/ntnic/nthw/core/nthw_pcie3.c
@@ -24,10 +24,7 @@ nthw_pcie3_t *nthw_pcie3_new(void)
 
 void nthw_pcie3_delete(nthw_pcie3_t *p)
 {
-       if (p) {
-               memset(p, 0, sizeof(nthw_pcie3_t));
-               free(p);
-       }
+       free(p);
 }
 
 int nthw_pcie3_init(nthw_pcie3_t *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/core/nthw_rpf.c 
b/drivers/net/ntnic/nthw/core/nthw_rpf.c
index 1ed4d7b4e0..d5c19e312b 100644
--- a/drivers/net/ntnic/nthw/core/nthw_rpf.c
+++ b/drivers/net/ntnic/nthw/core/nthw_rpf.c
@@ -22,10 +22,7 @@ nthw_rpf_t *nthw_rpf_new(void)
 
 void nthw_rpf_delete(nthw_rpf_t *p)
 {
-       if (p) {
-               memset(p, 0, sizeof(nthw_rpf_t));
-               free(p);
-       }
+       free(p);
 }
 
 int nthw_rpf_init(nthw_rpf_t *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/core/nthw_sdc.c 
b/drivers/net/ntnic/nthw/core/nthw_sdc.c
index ae967e5ed9..a7242a8a67 100644
--- a/drivers/net/ntnic/nthw/core/nthw_sdc.c
+++ b/drivers/net/ntnic/nthw/core/nthw_sdc.c
@@ -22,10 +22,7 @@ nthw_sdc_t *nthw_sdc_new(void)
 
 void nthw_sdc_delete(nthw_sdc_t *p)
 {
-       if (p) {
-               memset(p, 0, sizeof(nthw_sdc_t));
-               free(p);
-       }
+       free(p);
 }
 
 int nthw_sdc_init(nthw_sdc_t *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/core/nthw_si5340.c 
b/drivers/net/ntnic/nthw/core/nthw_si5340.c
index 05cadc0bf4..ceaa58e0f7 100644
--- a/drivers/net/ntnic/nthw/core/nthw_si5340.c
+++ b/drivers/net/ntnic/nthw/core/nthw_si5340.c
@@ -44,10 +44,7 @@ int nthw_si5340_init(nthw_si5340_t *p, nthw_iic_t 
*p_nthw_iic, uint8_t n_iic_add
 
 void nthw_si5340_delete(nthw_si5340_t *p)
 {
-       if (p) {
-               memset(p, 0, sizeof(nthw_si5340_t));
-               free(p);
-       }
+       free(p);
 }
 
 /*
diff --git a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c 
b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c
index fbaf0c2d6d..0838527716 100644
--- a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c
+++ b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c
@@ -183,7 +183,6 @@ nthw_fpga_mgr_t *nthw_fpga_mgr_new(void)
 
 void nthw_fpga_mgr_delete(nthw_fpga_mgr_t *p)
 {
-       memset(p, 0, sizeof(nthw_fpga_mgr_t));
        free(p);
 }
 
-- 
2.47.1

Reply via email to