[PATCH v1 01/31] net/ntnic: fix index verification

Serhii Iliushyk sil-plv at napatech.com
Tue Jan 21 18:07:39 CET 2025


From: Danylo Vodopianov <dvo-plv at napatech.com>

CI found couple coverity problems which were fixed in this commit.

CID: 448974, 448977, 448978 (OVERRUN).

These issues were fixed with updating index verification statement.

Coverity issue: 448974
Fixes: effa04693274 ("net/ntnic: add statistics")

Signed-off-by: Danylo Vodopianov <dvo-plv at napatech.com>
---
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
index 4c8503f689..e00b10ff82 100644
--- a/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
+++ b/drivers/net/ntnic/ntnic_filter/ntnic_filter.c
@@ -1201,7 +1201,7 @@ static int poll_statistics(struct pmd_internals *internals)
 	const int if_index = internals->n_intf_no;
 	uint64_t last_stat_rtc = 0;
 
-	if (!p_nt4ga_stat || if_index < 0 || if_index > NUM_ADAPTER_PORTS_MAX)
+	if (!p_nt4ga_stat || if_index < 0 || if_index >= NUM_ADAPTER_PORTS_MAX)
 		return -1;
 
 	assert(rte_tsc_freq > 0);
-- 
2.45.0



More information about the dev mailing list