From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id A3CC9A0471 for ; Wed, 19 Jun 2019 11:46:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D75F1C2BA; Wed, 19 Jun 2019 11:46:36 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 694241C2BA; Wed, 19 Jun 2019 11:46:35 +0200 (CEST) From: Asaf Penso To: yskoh@mellanox.com, shahafs@mellanox.com Cc: dev@dpdk.org, stable@dpdk.org Date: Wed, 19 Jun 2019 09:46:24 +0000 Message-Id: <1560937584-447773-1-git-send-email-asafp@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-stable] [PATCH] net/mlx5: fix check for rte calloc return value X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" 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@dpdk.org Signed-off-by: Asaf Penso --- 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