[dpdk-dev] net/sfc: do not dereference pointer before check vs NULL

Message ID 1491310161-24247-1-git-send-email-arybchenko@solarflare.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

Andrew Rybchenko April 4, 2017, 12:49 p.m. UTC
  Coverity issue: 1423925
Fixes: e18dbbd3083a ("net/sfc: remove EvQ info array to simplify reconfigure")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
---
It may be squashed into e18dbbd3083a.

 drivers/net/sfc/sfc_ev.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Comments

Ferruh Yigit April 4, 2017, 1:17 p.m. UTC | #1
On 4/4/2017 1:49 PM, Andrew Rybchenko wrote:
> Coverity issue: 1423925
> Fixes: e18dbbd3083a ("net/sfc: remove EvQ info array to simplify reconfigure")
> 
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Reviewed-by: Andy Moreton <amoreton@solarflare.com>
> ---
> It may be squashed into e18dbbd3083a.

Squashed into relevant commit in next-net, thanks.
  

Patch

diff --git a/drivers/net/sfc/sfc_ev.c b/drivers/net/sfc/sfc_ev.c
index 26e6b2f..160d39f 100644
--- a/drivers/net/sfc/sfc_ev.c
+++ b/drivers/net/sfc/sfc_ev.c
@@ -673,11 +673,12 @@  sfc_ev_qstart(struct sfc_evq *evq, unsigned int hw_index)
 void
 sfc_ev_qstop(struct sfc_evq *evq)
 {
-	struct sfc_adapter *sa = evq->sa;
+	if (evq == NULL)
+		return;
 
-	sfc_log_init(sa, "hw_index=%u", evq->evq_index);
+	sfc_log_init(evq->sa, "hw_index=%u", evq->evq_index);
 
-	if (evq == NULL || evq->init_state != SFC_EVQ_STARTED)
+	if (evq->init_state != SFC_EVQ_STARTED)
 		return;
 
 	evq->init_state = SFC_EVQ_INITIALIZED;