[dpdk-dev] [PATCH] net/mlx5: fix error number handling

Nélio Laranjeiro nelio.laranjeiro at 6wind.com
Tue Jun 5 08:52:46 CEST 2018


On Mon, Jun 04, 2018 at 10:37:31AM -0700, Yongseok Koh wrote:
> rte_errno should be saved only if error has occurred because rte_errno
> could have garbage value.
> 
> Fixes: a6d83b6a9209 ("net/mlx5: standardize on negative errno values")
> Cc: stable at dpdk.org
> 
> Signed-off-by: Yongseok Koh <yskoh at mellanox.com>
> ---
>  drivers/net/mlx5/mlx5_flow.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 994be05be..eaffe7495 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -3561,7 +3561,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev,
>  		/* The flow does not match. */
>  		continue;
>  	}
> -	ret = rte_errno; /* Save rte_errno before cleanup. */
> +	if (ret)
> +		ret = rte_errno; /* Save rte_errno before cleanup. */
>  	if (flow)
>  		mlx5_flow_list_destroy(dev, &priv->flows, flow);
>  exit:
> -- 
> 2.11.0

This patch is not enough, the returned value being -rte_errno if no
error is detected by the function it cannot set rte_errno nor return it.

Thanks,

-- 
Nélio Laranjeiro
6WIND


More information about the dev mailing list