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

Maxime Coquelin maxime.coquelin at redhat.com
Thu Mar 16 15:10:17 CET 2023



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 at dpdk.org
> 
> Signed-off-by: Hernan Vargas <hernan.vargas at 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 at redhat.com>

Thanks,
Maxime



More information about the stable mailing list