Skip to contentSkip to conversation

DPDK Coverity issue 381631, 381646

PATCH Superseded Hernan Vargas 2 participants 3 messages Jan 20, 2023 – Feb 6, 2023

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover DPDK Coverity issue 381631, 381646

Upstream fix to 23.03 for potential issue of dereferencing a pointer before null check.

Hernan Vargas (1):
baseband/acc: fix check after deref and dead code

 drivers/baseband/acc/rte_acc100_pmd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
Signature · 1 line
2.37.1
#1 lore raw

PATCH 1/1 baseband/acc: fix check after deref and dead code

Fix potential issue of dereferencing a pointer before null check. Remove null check for value that could never be null.

Coverity issue: 381646, 381631

Fixes 989dec301a9 ("baseband/acc100: add ring companion address")
---
 drivers/baseband/acc/rte_acc100_pmd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/baseband/acc/rte_acc100_pmd.c +2 -5
index 0992cb5d1e..a600511f4b 100644
@@ -4106,12 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
 	int ret, cbm;
 	struct rte_bbdev_enc_op *op;
 
-	if (q == NULL)
-		return 0;
-#ifdef RTE_LIBRTE_BBDEV_DEBUG
-	if (unlikely(ops == 0))
+	if (avail == 0)
 		return 0;
-#endif
+
 	op = acc_op_tail(q, 0);
 	if (unlikely(ops == NULL || op == NULL))
 		return 0;
Signature · 1 line
2.37.1
#2 lore raw

Re: [PATCH v1 1/1] baseband/acc: fix check after deref and dead code

Quoted 5 lines · Hernan Vargas

Fix potential issue of dereferencing a pointer before null check. Remove null check for value that could never be null.

Coverity issue: 381646, 381631

Fixes 989dec301a9 ("baseband/acc100: add ring companion address")

Please Cc stable, since it fixes a patch merged in v22.11.

Quoted 11 lines
---
  drivers/baseband/acc/rte_acc100_pmd.c | 7 ++-----
  1 file changed, 2 insertions(+), 5 deletions(-)
drivers/baseband/acc/rte_acc100_pmd.c +0 -0
index 0992cb5d1e..a600511f4b 100644

drivers/baseband/acc/rte_acc100_pmd.c acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data, · line 4109

Quoted 8 lines
drivers/baseband/acc/rte_acc100_pmd.c +1 -4
@@ -4106,12 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
  	int ret, cbm;
  	struct rte_bbdev_enc_op *op;
 
-	if (q == NULL)
-		return 0;
-#ifdef RTE_LIBRTE_BBDEV_DEBUG
-	if (unlikely(ops == 0))
+	if (avail == 0)

Introduction of this new check on avail is not explained in the commit message, it does not seem related to the purpose of this patch.

It looks like an optimization, so should be in a separate patch.

Quoted 6 lines
drivers/baseband/acc/rte_acc100_pmd.c +1 -1
  		return 0;
-#endif
+
  	op = acc_op_tail(q, 0);
  	if (unlikely(ops == NULL || op == NULL))
  		return 0;