DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/4] Coverity buf fixes for bnx2x
@ 2024-11-12 17:43 Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 1/4] net/bnx2x: remove dead conditional Stephen Hemminger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Stephen Hemminger @ 2024-11-12 17:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger

These are obvious issues spotted several releases ago
by Coverity, and seem to have ended up assigned to me.

Hold off the merge until it is tested on real hardware;
sorry, I don't have this NIC.

Stephen Hemminger (4):
  net/bnx2x: remove dead conditional
  net/bnx2x: fix always true expression
  net/bnx2x: fix possible infinite loop at startup
  net/bnx2x: fix duplicate branch

 drivers/net/bnx2x/bnx2x.c       | 19 +++++++------------
 drivers/net/bnx2x/bnx2x_stats.c |  3 ---
 2 files changed, 7 insertions(+), 15 deletions(-)

-- 
2.45.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/4] net/bnx2x: remove dead conditional
  2024-11-12 17:43 [PATCH 0/4] Coverity buf fixes for bnx2x Stephen Hemminger
@ 2024-11-12 17:43 ` Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 2/4] net/bnx2x: fix always true expression Stephen Hemminger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2024-11-12 17:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Julien Aube, Harish Patil

The second if test here is impossible because it contradicts
previous line.

Coverity issue: 384428
Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x_stats.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c
index d473c5e7ec..8adbe7e381 100644
--- a/drivers/net/bnx2x/bnx2x_stats.c
+++ b/drivers/net/bnx2x/bnx2x_stats.c
@@ -73,9 +73,6 @@ bnx2x_storm_stats_post(struct bnx2x_softc *sc)
 	int rc;
 
 	if (!sc->stats_pending) {
-		if (sc->stats_pending)
-			return;
-
 		sc->fw_stats_req->hdr.drv_stats_counter =
 			htole16(sc->stats_counter++);
 
-- 
2.45.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/4] net/bnx2x: fix always true expression
  2024-11-12 17:43 [PATCH 0/4] Coverity buf fixes for bnx2x Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 1/4] net/bnx2x: remove dead conditional Stephen Hemminger
@ 2024-11-12 17:43 ` Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 3/4] net/bnx2x: fix possible infinite loop at startup Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 4/4] net/bnx2x: fix duplicate branch Stephen Hemminger
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2024-11-12 17:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Julien Aube, Harish Patil

Coverity spotted that the check to enable single interrupt
mode would evaluate as always true since:

 The or condition sc->interrupt_mode != 2 || sc->interrupt_mode != 3
 will always be true because sc->interrupt_mode cannot be equal to
 two different values at the same time, so it must be not equal to
 at least one of them.

Coverity issue: 362046
Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index 3153cc4d80..af31ac4604 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -11189,11 +11189,9 @@ static int bnx2x_init_hw_func(struct bnx2x_softc *sc)
 /* Turn on a single ISR mode in IGU if driver is going to use
  * INT#x or MSI
  */
-		if ((sc->interrupt_mode != INTR_MODE_MSIX)
-		    || (sc->interrupt_mode != INTR_MODE_SINGLE_MSIX)) {
+		if (sc->interrupt_mode == INTR_MODE_INTX ||
+		    sc->interrupt_mode == INTR_MODE_MSI)
 			pf_conf |= IGU_PF_CONF_SINGLE_ISR_EN;
-		}
-
 /*
  * Timers workaround bug: function init part.
  * Need to wait 20msec after initializing ILT,
-- 
2.45.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/4] net/bnx2x: fix possible infinite loop at startup
  2024-11-12 17:43 [PATCH 0/4] Coverity buf fixes for bnx2x Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 1/4] net/bnx2x: remove dead conditional Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 2/4] net/bnx2x: fix always true expression Stephen Hemminger
@ 2024-11-12 17:43 ` Stephen Hemminger
  2024-11-12 17:43 ` [PATCH 4/4] net/bnx2x: fix duplicate branch Stephen Hemminger
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2024-11-12 17:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Julien Aube, Harish Patil

Coverity spotted that one of the loop conditions was always true.
Fix by initializing the variable using same logic as Linux
kernel driver.

Coverity issue: 362057
Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index af31ac4604..d96fcb55c9 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -10331,12 +10331,13 @@ static int bnx2x_init_hw_common(struct bnx2x_softc *sc)
 	REG_WR(sc, PXP2_REG_RD_DISABLE_INPUTS, 0);
 
 	if (!CHIP_IS_E1x(sc)) {
-		int factor = 0;
+		int factor = CHIP_REV_IS_EMUL(sc) ? 1000 :
+				(CHIP_REV_IS_FPGA(sc) ? 400 : 0);
 
 		ecore_init_block(sc, BLOCK_PGLUE_B, PHASE_COMMON);
 		ecore_init_block(sc, BLOCK_ATC, PHASE_COMMON);
 
-/* let the HW do it's magic... */
+		/* let the HW do it's magic... */
 		do {
 			DELAY(200000);
 			val = REG_RD(sc, ATC_REG_ATC_INIT_DONE);
-- 
2.45.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/4] net/bnx2x: fix duplicate branch
  2024-11-12 17:43 [PATCH 0/4] Coverity buf fixes for bnx2x Stephen Hemminger
                   ` (2 preceding siblings ...)
  2024-11-12 17:43 ` [PATCH 3/4] net/bnx2x: fix possible infinite loop at startup Stephen Hemminger
@ 2024-11-12 17:43 ` Stephen Hemminger
  3 siblings, 0 replies; 5+ messages in thread
From: Stephen Hemminger @ 2024-11-12 17:43 UTC (permalink / raw)
  To: dev; +Cc: Stephen Hemminger, Julien Aube, Harish Patil

Coverity spotted that both legs of the conditional are the same.
Looking at kernel driver there is additional code there, but the
kernel driver supports Wake On Lan, and DPDK does not.

Coverity issue: 362072
Fixes: 540a211084a7 ("bnx2x: driver core")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/bnx2x/bnx2x.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c
index d96fcb55c9..51e5cabf7b 100644
--- a/drivers/net/bnx2x/bnx2x.c
+++ b/drivers/net/bnx2x/bnx2x.c
@@ -1623,16 +1623,12 @@ static int bnx2x_nic_unload_no_mcp(struct bnx2x_softc *sc)
 }
 
 /* request unload mode from the MCP: COMMON, PORT or FUNCTION */
-static uint32_t bnx2x_send_unload_req(struct bnx2x_softc *sc, int unload_mode)
+static uint32_t bnx2x_send_unload_req(struct bnx2x_softc *sc, int unload_mode __rte_unused)
 {
 	uint32_t reset_code = 0;
 
 	/* Select the UNLOAD request mode */
-	if (unload_mode == UNLOAD_NORMAL) {
-		reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
-	} else {
-		reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
-	}
+	reset_code = DRV_MSG_CODE_UNLOAD_REQ_WOL_DIS;
 
 	/* Send the request to the MCP */
 	if (!BNX2X_NOMCP(sc)) {
-- 
2.45.2


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-11-12 17:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-12 17:43 [PATCH 0/4] Coverity buf fixes for bnx2x Stephen Hemminger
2024-11-12 17:43 ` [PATCH 1/4] net/bnx2x: remove dead conditional Stephen Hemminger
2024-11-12 17:43 ` [PATCH 2/4] net/bnx2x: fix always true expression Stephen Hemminger
2024-11-12 17:43 ` [PATCH 3/4] net/bnx2x: fix possible infinite loop at startup Stephen Hemminger
2024-11-12 17:43 ` [PATCH 4/4] net/bnx2x: fix duplicate branch Stephen Hemminger

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).