From 76e0e70e6452b971a69cc9794ff4a6715c11f7f2 Mon Sep 17 00:00:00 2001 From: Felix Manlunas Date: Tue, 7 Feb 2017 12:10:58 -0800 Subject: liquidio: do not dereference pointer if it's NULL 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 Signed-off-by: Felix Manlunas Signed-off-by: David S. Miller --- 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(-) (limited to 'drivers') diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c index c12cfa4113cc..a3c7b999e526 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 631f1c0f9e4d..0536cb9f6182 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); -- cgit v1.2.3