net/qede: fix dereference before null check
authorYunjian Wang <wangyunjian@huawei.com>
Mon, 24 Aug 2020 11:46:53 +0000 (19:46 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 30 Sep 2020 17:19:14 +0000 (19:19 +0200)
Coverity flags that 'fp->sb_info' variable is used before
it's checked for NULL. This patch fixes this issue.

Coverity issue: 260413
Fixes: 4c4bdadfa9e7 ("net/qede: refactoring multi-queue implementation")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/qede/qede_rxtx.c

index ea264f5..75d78ce 100644 (file)
@@ -676,9 +676,9 @@ void qede_dealloc_fp_resc(struct rte_eth_dev *eth_dev)
 
        for (sb_idx = 0; sb_idx < QEDE_RXTX_MAX(qdev); sb_idx++) {
                fp = &qdev->fp_array[sb_idx];
-               DP_INFO(edev, "Free sb_info index 0x%x\n",
-                               fp->sb_info->igu_sb_id);
                if (fp->sb_info) {
+                       DP_INFO(edev, "Free sb_info index 0x%x\n",
+                                       fp->sb_info->igu_sb_id);
                        OSAL_DMA_FREE_COHERENT(edev, fp->sb_info->sb_virt,
                                fp->sb_info->sb_phys,
                                sizeof(struct status_block));