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 3E9561B5F0; Mon, 26 Nov 2018 11:57:05 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Nov 2018 02:57:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,281,1539673200"; d="scan'208";a="103202070" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga003.jf.intel.com with ESMTP; 26 Nov 2018 02:57:04 -0800 Received: from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com [10.237.217.45]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id wAQAv35w019518; Mon, 26 Nov 2018 10:57:03 GMT Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id wAQAv3Tx006825; Mon, 26 Nov 2018 10:57:03 GMT Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id wAQAv3KK006821; Mon, 26 Nov 2018 10:57:03 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: thomas@monjalon.net, stable@dpdk.org Date: Mon, 26 Nov 2018 10:57:03 +0000 Message-Id: <294f089848bf803ff134979c612bbf28e0e2e6b9.1543229588.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-stable] [PATCH] mem: fix division by zero in no-NUMA mode X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Nov 2018 10:57:06 -0000 When RTE_EAL_NUMA_AWARE_HUGEPAGES is set to "n", not all memtypes will be valid, because we skip some due to not supporting other NUMA nodes, leading to a division by zero error down the line because the necessary memtype fields weren't populated. Fix it by limiting number of memtypes to number of memtypes we have actually created. Fixes: 1dd342d0fdc4 ("mem: improve segment list preallocation") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_memory.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/linuxapp/eal/eal_memory.c b/lib/librte_eal/linuxapp/eal/eal_memory.c index 6f94621d4..32feb415d 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memory.c +++ b/lib/librte_eal/linuxapp/eal/eal_memory.c @@ -2230,6 +2230,8 @@ memseg_primary_init(void) socket_id, hugepage_sz); } } + /* number of memtypes could have been lower due to no NUMA support */ + n_memtypes = cur_type; /* set up limits for types */ max_mem = (uint64_t)RTE_MAX_MEM_MB << 20; -- 2.17.1