liquidio: do not dereference pointer if it's NULL
Subsystems (3)
PATCH 1/1 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 <[email protected]>
Signed-off-by Felix Manlunas <[email protected]>
--- 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(-)
drivers/net/ethernet/cavium/liquidio/lio_main.c +1 -1
@@ -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);
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c +1 -1
@@ -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);
From: Felix Manlunas <[email protected]>
Date: Tue, 7 Feb 2017 12:10:58 -0800
Quoted 6 lines
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 <[email protected]>Signed-off-by Felix Manlunas <[email protected]>
Applied, thanks.