[PATCH v2 1/2] mempool: fix rte_errno in rte_mempool_create_empty

Konstantin Ananyev konstantin.ananyev at huawei.com
Fri Feb 7 15:30:01 CET 2025


> 
> When returning from rte_mempool_set_ops_byname(), rte_errno is not set
> for error exits.
> 
> The API requires rte_errno to be set in that case.
> 
> Bugzilla ID: 1559
> Fixes: c2c6b2f41305 ("mempool: fix default ops for an empty mempool")
> Link: https://doc.dpdk.org/api/rte__mempool_8h.html#a82e301ee33ed7a263ceb4582655dc3ea
> Signed-off-by: Ariel Otilibili <ariel.otilibili at 6wind.com>
> ---
>  lib/mempool/rte_mempool.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/mempool/rte_mempool.c b/lib/mempool/rte_mempool.c
> index d8e39e5c2072..1e4f24783c0b 100644
> --- a/lib/mempool/rte_mempool.c
> +++ b/lib/mempool/rte_mempool.c
> @@ -928,8 +928,10 @@ rte_mempool_create_empty(const char *name, unsigned n, unsigned elt_size,
>  	else
>  		ret = rte_mempool_set_ops_byname(mp, "ring_mp_mc", NULL);
> 
> -	if (ret)
> +	if (ret) {
> +		rte_errno = -ret;
>  		goto exit_unlock;
> +	}
> 
>  	/*
>  	 * local_cache pointer is set even if cache_size is zero.
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com> 

> 2.30.2



More information about the stable mailing list