* [PATCH v3 1/3] baseband/acc: fix check after deref and dead code
2023-02-22 16:40 [PATCH v3 0/3] DPDK Coverity issue 381631, 381646 Hernan Vargas
@ 2023-02-22 16:40 ` Hernan Vargas
2023-02-22 16:40 ` [PATCH v3 2/3] baseband/acc: remove unused ops check Hernan Vargas
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Hernan Vargas @ 2023-02-22 16:40 UTC (permalink / raw)
To: dev, maxime.coquelin, gakhil, trix
Cc: nicolas.chautru, qi.z.zhang, john.mcnamara, Hernan Vargas, stable
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")
Cc: stable@dpdk.org
Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
---
drivers/baseband/acc/rte_acc100_pmd.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index 36f6fec5ad..baab459436 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -4106,8 +4106,6 @@ 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))
return 0;
--
2.37.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] baseband/acc: remove unused ops check
2023-02-22 16:40 [PATCH v3 0/3] DPDK Coverity issue 381631, 381646 Hernan Vargas
2023-02-22 16:40 ` [PATCH v3 1/3] baseband/acc: fix check after deref and dead code Hernan Vargas
@ 2023-02-22 16:40 ` Hernan Vargas
2023-02-22 17:55 ` Maxime Coquelin
2023-02-22 16:40 ` [PATCH v3 3/3] baseband/acc: add check for empty queue Hernan Vargas
2023-02-23 9:29 ` [PATCH v3 0/3] DPDK Coverity issue 381631, 381646 Maxime Coquelin
3 siblings, 1 reply; 7+ messages in thread
From: Hernan Vargas @ 2023-02-22 16:40 UTC (permalink / raw)
To: dev, maxime.coquelin, gakhil, trix
Cc: nicolas.chautru, qi.z.zhang, john.mcnamara, Hernan Vargas
Remove unnecessary debug check for ops.
Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
drivers/baseband/acc/rte_acc100_pmd.c | 4 ----
1 file changed, 4 deletions(-)
diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index baab459436..c242f7737a 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -4106,10 +4106,6 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
int ret, cbm;
struct rte_bbdev_enc_op *op;
-#ifdef RTE_LIBRTE_BBDEV_DEBUG
- if (unlikely(ops == 0))
- return 0;
-#endif
op = acc_op_tail(q, 0);
if (unlikely(ops == NULL || op == NULL))
return 0;
--
2.37.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/3] baseband/acc: remove unused ops check
2023-02-22 16:40 ` [PATCH v3 2/3] baseband/acc: remove unused ops check Hernan Vargas
@ 2023-02-22 17:55 ` Maxime Coquelin
0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2023-02-22 17:55 UTC (permalink / raw)
To: Hernan Vargas, dev, gakhil, trix
Cc: nicolas.chautru, qi.z.zhang, john.mcnamara
On 2/22/23 17:40, Hernan Vargas wrote:
> Remove unnecessary debug check for ops.
>
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
> drivers/baseband/acc/rte_acc100_pmd.c | 4 ----
> 1 file changed, 4 deletions(-)
>
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index baab459436..c242f7737a 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -4106,10 +4106,6 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
> int ret, cbm;
> struct rte_bbdev_enc_op *op;
>
> -#ifdef RTE_LIBRTE_BBDEV_DEBUG
> - if (unlikely(ops == 0))
> - return 0;
> -#endif
> op = acc_op_tail(q, 0);
> if (unlikely(ops == NULL || op == NULL))
> return 0;
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] baseband/acc: add check for empty queue
2023-02-22 16:40 [PATCH v3 0/3] DPDK Coverity issue 381631, 381646 Hernan Vargas
2023-02-22 16:40 ` [PATCH v3 1/3] baseband/acc: fix check after deref and dead code Hernan Vargas
2023-02-22 16:40 ` [PATCH v3 2/3] baseband/acc: remove unused ops check Hernan Vargas
@ 2023-02-22 16:40 ` Hernan Vargas
2023-02-22 17:55 ` Maxime Coquelin
2023-02-23 9:29 ` [PATCH v3 0/3] DPDK Coverity issue 381631, 381646 Maxime Coquelin
3 siblings, 1 reply; 7+ messages in thread
From: Hernan Vargas @ 2023-02-22 16:40 UTC (permalink / raw)
To: dev, maxime.coquelin, gakhil, trix
Cc: nicolas.chautru, qi.z.zhang, john.mcnamara, Hernan Vargas
Add optimization to return early if there are no available descriptors
in ring to dequeue.
Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
drivers/baseband/acc/rte_acc100_pmd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
index c242f7737a..9941754aa0 100644
--- a/drivers/baseband/acc/rte_acc100_pmd.c
+++ b/drivers/baseband/acc/rte_acc100_pmd.c
@@ -4106,6 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
int ret, cbm;
struct rte_bbdev_enc_op *op;
+ if (avail == 0)
+ return 0;
+
op = acc_op_tail(q, 0);
if (unlikely(ops == NULL || op == NULL))
return 0;
--
2.37.1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 3/3] baseband/acc: add check for empty queue
2023-02-22 16:40 ` [PATCH v3 3/3] baseband/acc: add check for empty queue Hernan Vargas
@ 2023-02-22 17:55 ` Maxime Coquelin
0 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2023-02-22 17:55 UTC (permalink / raw)
To: Hernan Vargas, dev, gakhil, trix
Cc: nicolas.chautru, qi.z.zhang, john.mcnamara
On 2/22/23 17:40, Hernan Vargas wrote:
> Add optimization to return early if there are no available descriptors
> in ring to dequeue.
>
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
> drivers/baseband/acc/rte_acc100_pmd.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index c242f7737a..9941754aa0 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -4106,6 +4106,9 @@ acc100_dequeue_ldpc_enc(struct rte_bbdev_queue_data *q_data,
> int ret, cbm;
> struct rte_bbdev_enc_op *op;
>
> + if (avail == 0)
> + return 0;
> +
> op = acc_op_tail(q, 0);
> if (unlikely(ops == NULL || op == NULL))
> return 0;
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Thanks,
Maxime
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/3] DPDK Coverity issue 381631, 381646
2023-02-22 16:40 [PATCH v3 0/3] DPDK Coverity issue 381631, 381646 Hernan Vargas
` (2 preceding siblings ...)
2023-02-22 16:40 ` [PATCH v3 3/3] baseband/acc: add check for empty queue Hernan Vargas
@ 2023-02-23 9:29 ` Maxime Coquelin
3 siblings, 0 replies; 7+ messages in thread
From: Maxime Coquelin @ 2023-02-23 9:29 UTC (permalink / raw)
To: Hernan Vargas, dev, gakhil, trix
Cc: nicolas.chautru, qi.z.zhang, john.mcnamara
On 2/22/23 17:40, Hernan Vargas wrote:
> v3: Split commits further for clarity.
> v2: Split code unrelated to coverity fix in separate commit.
> v1: Upstream fix to 23.03 for potential issue of dereferencing a pointer before null check.
>
> Hernan Vargas (3):
> baseband/acc: fix check after deref and dead code
> baseband/acc: remove unused ops check
> baseband/acc: add check for empty queue
>
> drivers/baseband/acc/rte_acc100_pmd.c | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
>
Applied to dpdk-next-baseband/for-main.
Thanks,
Maxime
^ permalink raw reply [flat|nested] 7+ messages in thread