[PATCH v3 03/30] baseband/acc100: memory leak fix

Maxime Coquelin maxime.coquelin at redhat.com
Fri Oct 14 11:29:20 CEST 2022



On 10/12/22 04:53, Hernan Vargas wrote:
> Move check for undefined device before allocating queue data structure.
> 
> Coverity issue: 375803, 375813, 375819, 375827, 375831
> Fixes: 060e7672930 ("baseband/acc100: add queue configuration")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Hernan Vargas <hernan.vargas at intel.com>

No new line here.

> Reviewed-by: Maxime Coquelin <maxime.coquelin at redhat.com>
> ---
>   drivers/baseband/acc/rte_acc100_pmd.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/baseband/acc/rte_acc100_pmd.c b/drivers/baseband/acc/rte_acc100_pmd.c
> index b436bd9078..436af977e4 100644
> --- a/drivers/baseband/acc/rte_acc100_pmd.c
> +++ b/drivers/baseband/acc/rte_acc100_pmd.c
> @@ -662,6 +662,10 @@ acc100_queue_setup(struct rte_bbdev *dev, uint16_t queue_id,
>   	struct acc_queue *q;
>   	int16_t q_idx;
>   
> +	if (d == NULL) {
> +		rte_bbdev_log(ERR, "Undefined device");
> +		return -ENODEV;
> +	}
>   	/* Allocate the queue data structure. */
>   	q = rte_zmalloc_socket(dev->device->driver->name, sizeof(*q),
>   			RTE_CACHE_LINE_SIZE, conf->socket);
> @@ -669,10 +673,6 @@ acc100_queue_setup(struct rte_bbdev *dev, uint16_t queue_id,
>   		rte_bbdev_log(ERR, "Failed to allocate queue memory");
>   		return -ENOMEM;
>   	}
> -	if (d == NULL) {
> -		rte_bbdev_log(ERR, "Undefined device");
> -		return -ENODEV;
> -	}
>   
>   	q->d = d;
>   	q->ring_addr = RTE_PTR_ADD(d->sw_rings, (d->sw_ring_size * queue_id));



More information about the stable mailing list