net/qede: fix dereference before null check

Message ID ad8c842c14ee5f1520a849bfdc87b22beb99813e.1598246447.git.wangyunjian@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/qede: fix dereference before null check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Yunjian Wang Aug. 24, 2020, 11:46 a.m. UTC
  From: Yunjian Wang <wangyunjian@huawei.com>

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>
---
 drivers/net/qede/qede_rxtx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Ferruh Yigit Aug. 24, 2020, 12:41 p.m. UTC | #1
On 8/24/2020 12:46 PM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> 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>
  
Jerin Jacob Sept. 29, 2020, 6:08 p.m. UTC | #2
On Mon, Aug 24, 2020 at 6:11 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> On 8/24/2020 12:46 PM, wangyunjian wrote:
> > From: Yunjian Wang <wangyunjian@huawei.com>
> >
> > 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>

Applied to dpdk-next-net-mrvl/main. Thanks



>
  

Patch

diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c
index ea264f59d..75d78cebb 100644
--- a/drivers/net/qede/qede_rxtx.c
+++ b/drivers/net/qede/qede_rxtx.c
@@ -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));