From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id BDF812C13 for ; Wed, 28 Jun 2017 12:06:41 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Jun 2017 03:06:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.40,274,1496127600"; d="scan'208";a="1145599308" Received: from smonroyx-mobl.ger.corp.intel.com (HELO [10.237.221.32]) ([10.237.221.32]) by orsmga001.jf.intel.com with ESMTP; 28 Jun 2017 03:06:36 -0700 To: RongQiang Xie References: <201706280921.v5S9L22K090306@mse01.zte.com.cn> Cc: dev@dpdk.org From: Sergio Gonzalez Monroy Message-ID: Date: Wed, 28 Jun 2017 11:06:34 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: <201706280921.v5S9L22K090306@mse01.zte.com.cn> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug 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: Wed, 28 Jun 2017 10:06:42 -0000 On 28/06/2017 09:12, RongQiang Xie wrote: > Signed-off-by: RongQiang Xie > --- > lib/librte_eal/common/eal_common_memzone.c | 6 ++++++ > 1 file changed, 6 insertions(+) > mode change 100644 => 100755 lib/librte_eal/common/eal_common_memzone.c > > diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c > old mode 100644 > new mode 100755 > index 3026e36..8ea781b > --- a/lib/librte_eal/common/eal_common_memzone.c > +++ b/lib/librte_eal/common/eal_common_memzone.c > @@ -238,6 +238,12 @@ > } > > const struct malloc_elem *elem = malloc_elem_from_data(mz_addr); > + > + if (elem == NULL) { > + RTE_LOG(ERR, EAL, "%s(): Cannot malloc elem from data \n", __func__); > + rte_errno = ENOSPC; > + return NULL; > + } > > /* fill the zone in config */ > mz = get_next_free_memzone(); Hi, Could you elaborate how do you trigger this error? The only way you are getting NULL from malloc_elem_from_data is: A) data is NULL, which cannot be the case as we previously check for it B) cookies failure id you have DEBUG enabled, otherwise elem would have to be NULL Thanks, Sergio