From mboxrd@z Thu Jan 1 00:00:00 1970 From: RongQiang Xie Subject: [PATCH] lib/lib_eal:fix the pointer 'elem' may be NULL bug Date: Wed, 28 Jun 2017 16:12:35 +0800 Message-ID: <201706280921.v5S9L22K090306@mse01.zte.com.cn> Cc: dev@dpdk.org, RongQiang Xie To: sergio.gonzalez.monroy@intel.com Return-path: Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.217.80.70]) by dpdk.org (Postfix) with ESMTP id 166D237A6 for ; Wed, 28 Jun 2017 11:21:23 +0200 (CEST) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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(); -- 1.8.3.1