netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felix Manlunas <felix.manlunas@cavium.com>
To: <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>, <raghu.vatsavayi@cavium.com>,
	<derek.chickles@cavium.com>, <satananda.burla@cavium.com>,
	<dan.carpenter@oracle.com>
Subject: [PATCH net-next] liquidio: do not dereference pointer if it's NULL
Date: Tue, 7 Feb 2017 12:10:58 -0800	[thread overview]
Message-ID: <20170207201058.GA8962@felix.cavium.com> (raw)

Fix smatch errors by not dereferencing iq pointer if it's NULL.

See http://marc.info/?l=kernel-janitors&m=148637299004834&w=2

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
---
 drivers/net/ethernet/cavium/liquidio/lio_main.c    | 2 +-
 drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index c12cfa4..a3c7b99 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -2447,7 +2447,7 @@ static int liquidio_napi_poll(struct napi_struct *napi, int budget)
 
 	/* force enable interrupt if reg cnts are high to avoid wraparound */
 	if ((work_done < budget && tx_done) ||
-	    (iq->pkt_in_done >= MAX_REG_CNT) ||
+	    (iq && iq->pkt_in_done >= MAX_REG_CNT) ||
 	    (droq->pkt_count >= MAX_REG_CNT)) {
 		tx_done = 1;
 		napi_complete_done(napi, work_done);
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index 631f1c0f..0536cb9 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -1632,7 +1632,7 @@ static int liquidio_napi_poll(struct napi_struct *napi, int budget)
 
 	/* force enable interrupt if reg cnts are high to avoid wraparound */
 	if ((work_done < budget && tx_done) ||
-	    (iq->pkt_in_done >= MAX_REG_CNT) ||
+	    (iq && iq->pkt_in_done >= MAX_REG_CNT) ||
 	    (droq->pkt_count >= MAX_REG_CNT)) {
 		tx_done = 1;
 		napi_complete_done(napi, work_done);

             reply	other threads:[~2017-02-07 20:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-07 20:10 Felix Manlunas [this message]
2017-02-07 20:37 ` [PATCH net-next] liquidio: do not dereference pointer if it's NULL David Miller

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=20170207201058.GA8962@felix.cavium.com \
    --to=felix.manlunas@cavium.com \
    --cc=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=derek.chickles@cavium.com \
    --cc=netdev@vger.kernel.org \
    --cc=raghu.vatsavayi@cavium.com \
    --cc=satananda.burla@cavium.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).