[dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
Slava Ovsiienko
viacheslavo at mellanox.com
Tue Jul 2 17:00:34 CEST 2019
> -----Original Message-----
> From: dev <dev-bounces at dpdk.org> On Behalf Of Asaf Penso
> Sent: Wednesday, June 19, 2019 12:46
> To: Yongseok Koh <yskoh at mellanox.com>; Shahaf Shuler
> <shahafs at mellanox.com>
> Cc: dev at dpdk.org; stable at dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
>
> rte_calloc functions returns a non-null pointer in case of success and null
> pointer in case of failure.
>
> The return value should be checked and the function flow should take that
> into consideration.
>
> This patch adds a check for rte_calloc return value in function
> flow_list_create.
>
> Fixes: 84c406e7 ("net/mlx5: add flow translate function")
> Cc: stable at dpdk.org
>
> Signed-off-by: Asaf Penso <asafp at mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo at mellanox.com>
Thanks
> ---
> drivers/net/mlx5/mlx5_flow.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 9887018..a5821e5 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -2092,6 +2092,10 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
> else
> flow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void
> *));
> flow = rte_calloc(__func__, 1, flow_size, 0);
> + if (!flow) {
> + rte_errno = ENOMEM;
> + return NULL;
> + }
> flow->drv_type = flow_get_drv_type(dev, attr);
> flow->ingress = attr->ingress;
> flow->transfer = attr->transfer;
> --
> 1.8.3.1
More information about the dev
mailing list