From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
Christian Koue Muf <ckm@napatech.com>,
Serhii Iliushyk <sil-plv@napatech.com>
Subject: [PATCH v4 11/12] net/ntnic: remove unnecessary memset
Date: Thu, 14 Nov 2024 10:43:33 -0800 [thread overview]
Message-ID: <20241114184452.31854-12-stephen@networkplumber.org> (raw)
In-Reply-To: <20241114184452.31854-1-stephen@networkplumber.org>
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: Stephen Hemminger <stephen@networkplumber.org>
---
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/flow_filter/flow_nthw_cat.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_hsh.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_info.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_km.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_pdb.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_qsl.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c | 1 -
drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c | 5 +----
drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c | 5 +----
drivers/net/ntnic/nthw/model/nthw_fpga_model.c | 1 -
21 files changed, 19 insertions(+), 78 deletions(-)
diff --git a/drivers/net/ntnic/nthw/core/nthw_hif.c b/drivers/net/ntnic/nthw/core/nthw_hif.c
index 9f699e4f94..d702257d76 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 269754c24a..a98ec659c4 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 5997ebb419..a5833e166c 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 fc73e6957c..e32d87b967 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/flow_filter/flow_nthw_cat.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_cat.c
index 649a060682..776d4986f7 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_cat.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_cat.c
@@ -25,10 +25,7 @@ struct cat_nthw *cat_nthw_new(void)
void cat_nthw_delete(struct cat_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
void cat_nthw_set_debug_mode(struct cat_nthw *p, unsigned int n_debug_mode)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c
index dc3582c9f5..036a25d06c 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_csu.c
@@ -29,10 +29,7 @@ struct csu_nthw *csu_nthw_new(void)
void csu_nthw_delete(struct csu_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int csu_nthw_init(struct csu_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c
index 7647949bc7..e016c80bc9 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c
@@ -26,10 +26,7 @@ struct flm_nthw *flm_nthw_new(void)
void flm_nthw_delete(struct flm_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
void flm_nthw_set_debug_mode(struct flm_nthw *p, unsigned int n_debug_mode)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c
index d0e65c071d..02064f1bc6 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hfu.c
@@ -29,10 +29,7 @@ struct hfu_nthw *hfu_nthw_new(void)
void hfu_nthw_delete(struct hfu_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int hfu_nthw_init(struct hfu_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hsh.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hsh.c
index caf84790cd..10f982ea76 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hsh.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_hsh.c
@@ -30,10 +30,7 @@ struct hsh_nthw *hsh_nthw_new(void)
void hsh_nthw_delete(struct hsh_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int hsh_nthw_init(struct hsh_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_info.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_info.c
index 007c71d1b0..acdc40b8b1 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_info.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_info.c
@@ -30,10 +30,7 @@ struct info_nthw *info_nthw_new(void)
void info_nthw_delete(struct info_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int info_nthw_init(struct info_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_km.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_km.c
index 3909194214..7acdd6d36f 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_km.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_km.c
@@ -39,10 +39,7 @@ struct km_nthw *km_nthw_new(void)
void km_nthw_delete(struct km_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int km_nthw_init(struct km_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_pdb.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_pdb.c
index 700d868cef..850bb1d22d 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_pdb.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_pdb.c
@@ -30,10 +30,7 @@ struct pdb_nthw *pdb_nthw_new(void)
void pdb_nthw_delete(struct pdb_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int pdb_nthw_init(struct pdb_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_qsl.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_qsl.c
index 47fea6553f..ccc5f46f02 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_qsl.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_qsl.c
@@ -30,10 +30,7 @@ struct qsl_nthw *qsl_nthw_new(void)
void qsl_nthw_delete(struct qsl_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int qsl_nthw_init(struct qsl_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c
index 2f141acbde..11f691dcb5 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_rpp_lr.c
@@ -29,10 +29,7 @@ struct rpp_lr_nthw *rpp_lr_nthw_new(void)
void rpp_lr_nthw_delete(struct rpp_lr_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int rpp_lr_nthw_init(struct rpp_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c
index e278ad0a41..8b51fa18ad 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_slc_lr.c
@@ -30,10 +30,7 @@ struct slc_lr_nthw *slc_lr_nthw_new(void)
void slc_lr_nthw_delete(struct slc_lr_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int slc_lr_nthw_init(struct slc_lr_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c
index 58e5672462..f7987b9c8c 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_cpy.c
@@ -31,7 +31,6 @@ void tx_cpy_nthw_delete(struct tx_cpy_nthw *p)
{
if (p) {
free(p->m_writers);
- memset(p, 0, sizeof(*p));
free(p);
}
}
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c
index 0ff9af22c7..c21fb5413b 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_ins.c
@@ -29,10 +29,7 @@ struct tx_ins_nthw *tx_ins_nthw_new(void)
void tx_ins_nthw_delete(struct tx_ins_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int tx_ins_nthw_init(struct tx_ins_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c
index 221ea94eed..62bed95be1 100644
--- a/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c
+++ b/drivers/net/ntnic/nthw/flow_filter/flow_nthw_tx_rpl.c
@@ -29,10 +29,7 @@ struct tx_rpl_nthw *tx_rpl_nthw_new(void)
void tx_rpl_nthw_delete(struct tx_rpl_nthw *p)
{
- if (p) {
- memset(p, 0, sizeof(*p));
- free(p);
- }
+ free(p);
}
int tx_rpl_nthw_init(struct tx_rpl_nthw *p, nthw_fpga_t *p_fpga, int n_instance)
diff --git a/drivers/net/ntnic/nthw/model/nthw_fpga_model.c b/drivers/net/ntnic/nthw/model/nthw_fpga_model.c
index 9eaaeb550d..0fb525d34f 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.45.2
next prev parent reply other threads:[~2024-11-14 18:46 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 1:10 [PATCH 0/3] introduce rte_memset_sensative Stephen Hemminger
2024-11-14 1:10 ` [PATCH 1/3] eal: " Stephen Hemminger
2024-11-14 1:10 ` [PATCH 2/3] crypto/qat: use rte_memset_sensative Stephen Hemminger
2024-11-14 1:10 ` [PATCH 3/3] eal: add rte_free_sensative Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 0/8] memset security handling Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 1/8] eal: introduce new secure memory fill Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 2/8] eal: add new secure free function Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 3/8] crypto/qat: force zero of keys Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 4/8] crypto/qat: fix size calculation for memset Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 5/8] crypto/qat: use secure memset Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 6/8] bus/uacce: remove memset before free Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 7/8] compress/octeontx: remove unnecessary memset Stephen Hemminger
2024-11-14 1:52 ` [PATCH v2 8/8] test: remove unneeded memset Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 00/11] memset security handling Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 01/11] eal: introduce new secure memory fill Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 02/11] eal: add new secure free function Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 03/11] crypto/qat: force zero of keys Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 04/11] crypto/qat: fix size calculation for memset Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 05/11] crypto/qat: use secure memset Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 06/11] bus/uacce: remove memset before free Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 07/11] compress/octeontx: remove unnecessary memset Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 08/11] test: remove unneeded memset Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 09/11] net/ntnic: remove unnecessary void cast Stephen Hemminger
2024-11-14 2:35 ` [PATCH v3 10/11] net/ntnic: check result of malloc Stephen Hemminger
2024-11-14 2:36 ` [PATCH v3 11/11] net/ntnic: remove unnecessary memset Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 00/12] memset security fixes Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 01/12] eal: introduce new secure memory fill Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 02/12] eal: add new secure free function Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 03/12] crypto/qat: force zero of keys Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 04/12] crypto/qat: fix size calculation for memset Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 05/12] crypto/qat: use secure memset Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 06/12] bus/uacce: remove memset before free Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 07/12] compress/octeontx: remove unnecessary memset Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 08/12] test: remove unneeded memset Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 09/12] net/ntnic: remove unnecessary void cast Stephen Hemminger
2024-11-14 18:43 ` [PATCH v4 10/12] net/ntnic: check result of malloc Stephen Hemminger
2024-11-14 18:43 ` Stephen Hemminger [this message]
2024-11-14 18:43 ` [PATCH v4 12/12] devtools/cocci: add script to find problematic memset Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241114184452.31854-12-stephen@networkplumber.org \
--to=stephen@networkplumber.org \
--cc=ckm@napatech.com \
--cc=dev@dpdk.org \
--cc=sil-plv@napatech.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).