[v1,2/2] test/bbdev: fix unchecked ret value issue

Message ID 20230309033624.61660-3-hernan.vargas@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Maxime Coquelin
Headers
Series test-bbdev coverity fixes |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/github-robot: build success github build: passed
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS

Commit Message

Hernan Vargas March 9, 2023, 3:36 a.m. UTC
  Add check for return value from get_bbdev_queue_stats.

Coverity issue: 383155
Fixes: c25604355a15 ("app/bbdev: add explicit check for counters")
Cc: stable@dpdk.org

Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
---
 app/test-bbdev/test_bbdev_perf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
  

Comments

Maxime Coquelin March 16, 2023, 2:10 p.m. UTC | #1
On 3/9/23 04:36, Hernan Vargas wrote:
> Add check for return value from get_bbdev_queue_stats.
> 
> Coverity issue: 383155
> Fixes: c25604355a15 ("app/bbdev: add explicit check for counters")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hernan Vargas <hernan.vargas@intel.com>
> ---
>   app/test-bbdev/test_bbdev_perf.c | 7 +++++--
>   1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
> index 15ebcdfc1556..276bbf0a2e6d 100644
> --- a/app/test-bbdev/test_bbdev_perf.c
> +++ b/app/test-bbdev/test_bbdev_perf.c
> @@ -5679,7 +5679,7 @@ static int
>   offload_cost_test(struct active_device *ad,
>   		struct test_op_params *op_params)
>   {
> -	int iter;
> +	int iter, ret;
>   	uint16_t burst_sz = op_params->burst_sz;
>   	const uint16_t num_to_process = op_params->num_to_process;
>   	const enum rte_bbdev_op_type op_type = test_vector.op_type;
> @@ -5774,7 +5774,10 @@ offload_cost_test(struct active_device *ad,
>   			rte_get_tsc_hz());
>   
>   	struct rte_bbdev_stats stats = {0};
> -	get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
> +	ret = get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
> +	TEST_ASSERT_SUCCESS(ret,
> +			"Failed to get stats for queue (%u) of device (%u)",
> +			queue_id, ad->dev_id);
>   	if (stats.enqueue_warn_count > 0)
>   		printf("Warning reported on the queue : %10"PRIu64"\n",
>   			stats.enqueue_warn_count);

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime
  

Patch

diff --git a/app/test-bbdev/test_bbdev_perf.c b/app/test-bbdev/test_bbdev_perf.c
index 15ebcdfc1556..276bbf0a2e6d 100644
--- a/app/test-bbdev/test_bbdev_perf.c
+++ b/app/test-bbdev/test_bbdev_perf.c
@@ -5679,7 +5679,7 @@  static int
 offload_cost_test(struct active_device *ad,
 		struct test_op_params *op_params)
 {
-	int iter;
+	int iter, ret;
 	uint16_t burst_sz = op_params->burst_sz;
 	const uint16_t num_to_process = op_params->num_to_process;
 	const enum rte_bbdev_op_type op_type = test_vector.op_type;
@@ -5774,7 +5774,10 @@  offload_cost_test(struct active_device *ad,
 			rte_get_tsc_hz());
 
 	struct rte_bbdev_stats stats = {0};
-	get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+	ret = get_bbdev_queue_stats(ad->dev_id, queue_id, &stats);
+	TEST_ASSERT_SUCCESS(ret,
+			"Failed to get stats for queue (%u) of device (%u)",
+			queue_id, ad->dev_id);
 	if (stats.enqueue_warn_count > 0)
 		printf("Warning reported on the queue : %10"PRIu64"\n",
 			stats.enqueue_warn_count);