From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dggrg01-dlp.huawei.com (unknown [45.249.212.187]) by dpdk.org (Postfix) with ESMTP id E8D94695D for ; Tue, 28 Mar 2017 10:20:02 +0200 (CEST) Received: from 172.30.72.57 (EHLO DGGEML403-HUB.china.huawei.com) ([172.30.72.57]) by dggrg01-dlp.huawei.com (MOS 4.4.6-GA FastPath queued) with ESMTP id ALQ02812; Tue, 28 Mar 2017 16:20:00 +0800 (CST) Received: from localhost (10.177.241.238) by DGGEML403-HUB.china.huawei.com (10.3.17.33) with Microsoft SMTP Server id 14.3.301.0; Tue, 28 Mar 2017 16:19:50 +0800 From: henry To: CC: , , , , henry Date: Tue, 28 Mar 2017 16:19:27 +0800 Message-ID: <1490689167-8660-1-git-send-email-caihe@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.177.241.238] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020203.58DA1CB0.0174, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 6aa0da103fe4777ee31d990ae921bceb Subject: [dpdk-dev] [PATCH v2] net/i40e: fix a bug in function i40evf_add_del_all_mac_addr 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: Tue, 28 Mar 2017 08:20:04 -0000 check return value of rte_zmalloc Signed-off-by: henry --- drivers/net/i40e/i40e_ethdev_vf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index 55fd344..fdb5be6 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -2014,6 +2014,12 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev, } list = rte_zmalloc("i40evf_del_mac_buffer", len, 0); + if (!list) { + PMD_DRV_LOG(ERR, "abort execute command %s", + add ? "OP_ADD_ETHER_ADDRESS" : + "OP_DEL_ETHER_ADDRESS"); + return; + } for (i = begin; i < next_begin; i++) { addr = &dev->data->mac_addrs[i]; -- 1.8.3.1