]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
liquidio: do not dereference pointer if it's NULL
authorFelix Manlunas <felix.manlunas@cavium.com>
Tue, 7 Feb 2017 20:10:58 +0000 (12:10 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 7 Feb 2017 20:37:43 +0000 (15:37 -0500)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/cavium/liquidio/lio_main.c
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c

index c12cfa4113ccef6e3e3f4a8dfa73de05d132d30a..a3c7b999e526d3275c1b0b03bfb49358e44bd1f6 100644 (file)
@@ -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);
index 631f1c0f9e4d09cfbca813cda9201754b0619735..0536cb9f6182eaae33ce6f42cdd84f8aed4fcf6d 100644 (file)
@@ -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);