From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) by dpdk.org (Postfix) with ESMTP id 9CFF11B022 for ; Wed, 20 Dec 2017 11:38:25 +0100 (CET) Received: from mse01.zte.com.cn (unknown [10.30.3.20]) by Forcepoint Email with ESMTPS id 84C1176FAC03E74CBC47; Wed, 20 Dec 2017 18:38:24 +0800 (CST) Received: from notes_smtp.zte.com.cn ([10.30.1.239]) by mse01.zte.com.cn with ESMTP id vBKAcC3S085721; Wed, 20 Dec 2017 18:38:12 +0800 (GMT-8) (envelope-from wang.yong19@zte.com.cn) Received: from localhost.localdomain.localdomain ([10.43.166.165]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2017122018381916-4960769 ; Wed, 20 Dec 2017 18:38:19 +0800 From: Yong Wang To: hemant.agrawal@nxp.com, beilei.xing@intel.com, wenzhuo.lu@intel.com, john.griffin@intel.com Cc: dev@dpdk.org, Yong Wang Date: Wed, 20 Dec 2017 05:23:17 -0500 Message-Id: <1513765398-3716-3-git-send-email-wang.yong19@zte.com.cn> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1513765398-3716-1-git-send-email-wang.yong19@zte.com.cn> References: <1513765398-3716-1-git-send-email-wang.yong19@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2017-12-20 18:38:19, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2017-12-20 18:38:04, Serialize complete at 2017-12-20 18:38:04 X-MAIL: mse01.zte.com.cn vBKAcC3S085721 Subject: [dpdk-dev] [PATCH v2 3/4] net/e1000: add null point check for rte_zmalloc X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2017 10:38:26 -0000 Signed-off-by: Yong Wang --- drivers/net/e1000/igb_flow.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c index 22bad26..057579b 100644 --- a/drivers/net/e1000/igb_flow.c +++ b/drivers/net/e1000/igb_flow.c @@ -1345,6 +1345,11 @@ if (!ret) { ntuple_filter_ptr = rte_zmalloc("igb_ntuple_filter", sizeof(struct igb_ntuple_filter_ele), 0); + if (!ntuple_filter_ptr) { + PMD_DRV_LOG(ERR, "failed to allocate memory"); + goto out; + } + rte_memcpy(&ntuple_filter_ptr->filter_info, &ntuple_filter, sizeof(struct rte_eth_ntuple_filter)); @@ -1367,6 +1372,11 @@ ethertype_filter_ptr = rte_zmalloc( "igb_ethertype_filter", sizeof(struct igb_ethertype_filter_ele), 0); + if (!ethertype_filter_ptr) { + PMD_DRV_LOG(ERR, "failed to allocate memory"); + goto out; + } + rte_memcpy(ðertype_filter_ptr->filter_info, ðertype_filter, sizeof(struct rte_eth_ethertype_filter)); @@ -1387,6 +1397,11 @@ if (!ret) { syn_filter_ptr = rte_zmalloc("igb_syn_filter", sizeof(struct igb_eth_syn_filter_ele), 0); + if (!syn_filter_ptr) { + PMD_DRV_LOG(ERR, "failed to allocate memory"); + goto out; + } + rte_memcpy(&syn_filter_ptr->filter_info, &syn_filter, sizeof(struct rte_eth_syn_filter)); @@ -1408,6 +1423,11 @@ if (!ret) { flex_filter_ptr = rte_zmalloc("igb_flex_filter", sizeof(struct igb_flex_filter_ele), 0); + if (!flex_filter_ptr) { + PMD_DRV_LOG(ERR, "failed to allocate memory"); + goto out; + } + rte_memcpy(&flex_filter_ptr->filter_info, &flex_filter, sizeof(struct rte_eth_flex_filter)); -- 1.8.3.1