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 59C3FF618 for ; Sat, 25 Mar 2017 13:44:53 +0100 (CET) Received: from 172.24.1.60 (EHLO SZXEMI414-HUB.china.huawei.com) ([172.24.1.60]) by szxrg03-dlp.huawei.com (MOS 4.4.3-GA FastPath queued) with ESMTP id CQS96246; Sat, 25 Mar 2017 20:44:35 +0800 (CST) Received: from SZXEMI508-MBS.china.huawei.com ([169.254.10.152]) by SZXEMI414-HUB.china.huawei.com ([10.86.210.49]) with mapi id 14.03.0235.001; Sat, 25 Mar 2017 20:44:29 +0800 From: caihe To: "rahul.lakkireddy@chelsio.com" CC: "dev@dpdk.org" , wangyunjian , "Lilijun (Jerry)" , Zhoujingbin Thread-Topic: [dpdk-dev] [PATCH 1/1] net/cxgbe: check return value of malloc Thread-Index: AdKlZQTDB7hYyAo0R6eXXo5rCXuedw== Date: Sat, 25 Mar 2017 12:44:29 +0000 Message-ID: <453363AE6316CC428D594009B784F9050335F159@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/cxgbe: check return value of malloc 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:44:57 -0000 Hi rahul, There is a bug without check the return value of alloc memory in function t= 4_wr_mbox_meat_timeout, if we should fix it as below: diff --git a/drivers/net/cxgbe/base/t4_hw.c b/drivers/net/cxgbe/base/t4_hw.= c index c089b06..7402a5f 100644 --- a/drivers/net/cxgbe/base/t4_hw.c +++ b/drivers/net/cxgbe/base/t4_hw.c @@ -359,6 +359,10 @@ int t4_wr_mbox_meat_timeout(struct adapter *adap, int = mbox, struct mbox_entry entry; u32 pcie_fw =3D 0; =20 + if (!temp) { + return -ENOMEM; + } + if ((size & 15) || size > MBOX_LEN) { free(temp); return -EINVAL; Best Regards