liquidio: fix Coverity scan errors
authorFelix Manlunas <felix.manlunas@cavium.com>
Tue, 21 Mar 2017 02:04:48 +0000 (19:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 Mar 2017 18:48:34 +0000 (11:48 -0700)
Fix Coverity scan errors by not dereferencing lio->glists_dma_base pointer
if it's NULL.

See http://marc.info/?l=linux-netdev&m=149002294305614&w=2

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Felix Manlunas <felix.manlunas@cavium.com>
Signed-off-by: VSR Burru <veerasenareddy.burru@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 b23485c3af13225fdcaca29c4a3d3871958eb707..0bc76ad96a17391bc7a0bfcc2e92e97920165c75 100644 (file)
@@ -712,7 +712,8 @@ static void delete_glists(struct lio *lio)
                                kfree(g);
                } while (g);
 
-               if (lio->glists_virt_base && lio->glists_virt_base[i]) {
+               if (lio->glists_virt_base && lio->glists_virt_base[i] &&
+                   lio->glists_dma_base && lio->glists_dma_base[i]) {
                        lio_dma_free(lio->oct_dev,
                                     lio->glist_entry_size * lio->tx_qsize,
                                     lio->glists_virt_base[i],
index f72db33fcd3afc4d4b2b3e6f7a481171a0829f6b..e03855b8d1f56dd28aaeb937897e009ca4e3b408 100644 (file)
@@ -470,7 +470,8 @@ static void delete_glists(struct lio *lio)
                                kfree(g);
                } while (g);
 
-               if (lio->glists_virt_base && lio->glists_virt_base[i]) {
+               if (lio->glists_virt_base && lio->glists_virt_base[i] &&
+                   lio->glists_dma_base && lio->glists_dma_base[i]) {
                        lio_dma_free(lio->oct_dev,
                                     lio->glist_entry_size * lio->tx_qsize,
                                     lio->glists_virt_base[i],