From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8]) by dpdk.org (Postfix) with ESMTP id BBAADF983 for ; Mon, 27 Mar 2017 09:35:50 +0200 (CEST) Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94]) by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id v2R7Zl8U028225; Mon, 27 Mar 2017 00:35:48 -0700 Date: Mon, 27 Mar 2017 13:05:12 +0530 From: Rahul Lakkireddy To: caihe Cc: "dev@dpdk.org" , wangyunjian , "Lilijun (Jerry)" , Zhoujingbin , Kumar Sanghvi , Nirranjan Kirubaharan Message-ID: <20170327073511.GA31514@chelsio.com> References: <453363AE6316CC428D594009B784F9050335F159@SZXEMI508-MBS.china.huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <453363AE6316CC428D594009B784F9050335F159@SZXEMI508-MBS.china.huawei.com> User-Agent: Mutt/1.5.24 (2015-08-30) Subject: Re: [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: Mon, 27 Mar 2017 07:35:51 -0000 On Saturday, March 03/25/17, 2017 at 18:14:29 +0530, caihe wrote: > Hi rahul, > > There is a bug without check the return value of alloc memory in function > t4_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 = 0; >   > +       if (!temp) { > +               return -ENOMEM; > +       } > + >         if ((size & 15) || size > MBOX_LEN) { >                 free(temp); >                 return -EINVAL; > > Best Regards Thanks for the fix! However, there seem to be checkpatch issues with the patch that need to be fixed. http://dpdk.org/ml/archives/test-report/2017-March/015606.html Thanks, Rahul