From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [119.145.14.66]) by dpdk.org (Postfix) with ESMTP id 9EFFCF6A8 for ; Sat, 25 Mar 2017 13:30:41 +0100 (CET) Received: from 172.24.1.36 (EHLO SZXEMI402-HUB.china.huawei.com) ([172.24.1.36]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CQS95669; Sat, 25 Mar 2017 20:30:36 +0800 (CST) Received: from SZXEMI508-MBS.china.huawei.com ([169.254.10.152]) by SZXEMI402-HUB.china.huawei.com ([10.83.65.54]) with mapi id 14.03.0235.001; Sat, 25 Mar 2017 20:30:29 +0800 From: caihe To: "helin.zhang@intel.com" CC: "jingjing.wu@intel.com" , "dev@dpdk.org" , wangyunjian , "Lilijun (Jerry)" , Zhoujingbin Thread-Topic: [dpdk-dev] [PATCH 1/1] net/i40e: check return value of rte_zmalloc Thread-Index: AdKlY4PXehXrYe03RFO4Qp1wBl8x9g== Date: Sat, 25 Mar 2017 12:30:28 +0000 Message-ID: <453363AE6316CC428D594009B784F9050335F139@SZXEMI508-MBS.china.huawei.com> Accept-Language: en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.177.241.238] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 1/1] net/i40e: check return value of 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: Sat, 25 Mar 2017 12:30:44 -0000 Hi helin, There is a bug without check the return value of alloc memory in function i= 40evf_add_del_all_mac_addr, if we should fix it as below: diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethd= ev_vf.c index 55fd344..37ea7ac 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -2014,6 +2014,11 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev = *dev, } =20 list =3D rte_zmalloc("i40evf_del_mac_buffer", len, 0); + if (!list) { + PMD_DRV_LOG(ERR, "fail to alloc memory, abort execu= te command %s", + add ? "OP_ADD_ETHER_ADDRESS" : "OP_DEL_ETHE= R_ADDRESS"); + return; + } =20 for (i =3D begin; i < next_begin; i++) { addr =3D &dev->data->mac_addrs[i]; Best Regards