From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C2863A053A;
	Mon, 27 Jul 2020 16:03:50 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 547B31BFD9;
	Mon, 27 Jul 2020 16:03:50 +0200 (CEST)
Received: from huawei.com (szxga06-in.huawei.com [45.249.212.32])
 by dpdk.org (Postfix) with ESMTP id 3740A1BFBA;
 Mon, 27 Jul 2020 16:03:48 +0200 (CEST)
Received: from DGGEMS408-HUB.china.huawei.com (unknown [172.30.72.58])
 by Forcepoint Email with ESMTP id 9ADAD105FF839C087868;
 Mon, 27 Jul 2020 22:03:46 +0800 (CST)
Received: from localhost (10.174.185.168) by DGGEMS408-HUB.china.huawei.com
 (10.3.19.208) with Microsoft SMTP Server id 14.3.487.0; Mon, 27 Jul 2020
 22:03:38 +0800
From: wangyunjian <wangyunjian@huawei.com>
To: <dev@dpdk.org>, <nikhil.rao@intel.com>
CC: <jerry.lilijun@huawei.com>, <xudingke@huawei.com>, Yunjian Wang
 <wangyunjian@huawei.com>, <stable@dpdk.org>
Date: Mon, 27 Jul 2020 22:03:14 +0800
Message-ID: <f12b6805dd3a9099a10236a2ad864dabc3860cc0.1595854066.git.wangyunjian@huawei.com>
X-Mailer: git-send-email 1.9.5.msysgit.1
MIME-Version: 1.0
Content-Type: text/plain
X-Originating-IP: [10.174.185.168]
X-CFilter-Loop: Reflected
Subject: [dpdk-dev] [PATCH] eventdev: fix return value of null not checked
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

From: Yunjian Wang <wangyunjian@huawei.com>

The function rte_zmalloc() could return NULL, the return value
need to be checked.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 lib/librte_eventdev/rte_event_eth_tx_adapter.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/librte_eventdev/rte_event_eth_tx_adapter.c b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
index bb21dc407..86287b4e6 100644
--- a/lib/librte_eventdev/rte_event_eth_tx_adapter.c
+++ b/lib/librte_eventdev/rte_event_eth_tx_adapter.c
@@ -734,6 +734,8 @@ txa_service_queue_add(uint8_t id,
 
 		qdone = rte_zmalloc(txa->mem_name,
 				nb_queues * sizeof(*qdone), 0);
+		if (qdone == NULL)
+			return -ENOMEM;
 		j = 0;
 		for (i = 0; i < nb_queues; i++) {
 			if (txa_service_is_queue_added(txa, eth_dev, i))
-- 
2.23.0