From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 37FDE548B; Fri, 9 Sep 2016 10:24:33 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 09 Sep 2016 01:24:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,304,1470726000"; d="scan'208";a="166162210" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by fmsmga004.fm.intel.com with ESMTP; 09 Sep 2016 01:24:31 -0700 Date: Fri, 9 Sep 2016 16:25:01 +0800 From: Yuanhan Liu To: Olivier Matz Cc: dev@dpdk.org, pablo.de.lara.guarch@intel.com, stable@dpdk.org Message-ID: <20160909082501.GW7328@yliu-dev.sh.intel.com> References: <1473408985-13131-1-git-send-email-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1473408985-13131-1-git-send-email-olivier.matz@6wind.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-stable] [PATCH] testpmd: fix crash when mempool allocation fails X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Sep 2016 08:24:33 -0000 On Fri, Sep 09, 2016 at 10:16:25AM +0200, Olivier Matz wrote: > Avoid access to mempool pointer if it is NULL. > > Fixes: b19a0c75a0d4 ("app/testpmd: remove anonymous mempool code") > Coverity issue: 127553 > > Signed-off-by: Olivier Matz > --- > app/test-pmd/testpmd.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index 1428974..e0f8285 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -444,10 +444,13 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, > mb_size, (unsigned) mb_mempool_cache, > sizeof(struct rte_pktmbuf_pool_private), > socket_id, 0); > + if (rte_mp == NULL) > + goto err; > > if (rte_mempool_populate_anon(rte_mp) == 0) { > rte_mempool_free(rte_mp); > rte_mp = NULL; > + goto err; > } > rte_pktmbuf_pool_init(rte_mp, NULL); > rte_mempool_obj_iter(rte_mp, rte_pktmbuf_init, NULL); > @@ -458,6 +461,7 @@ mbuf_pool_create(uint16_t mbuf_seg_size, unsigned nb_mbuf, > } > } > > + err: A minor nit: there is a heading white space char. --yliu > if (rte_mp == NULL) { > rte_exit(EXIT_FAILURE, > "Creation of mbuf pool for socket %u failed: %s\n", > -- > 2.8.1