From patchwork Tue Jul 17 15:41:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anatoly Burakov X-Patchwork-Id: 43154 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A125B2B92; Tue, 17 Jul 2018 17:41:59 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 80866160 for ; Tue, 17 Jul 2018 17:41:57 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Jul 2018 08:41:46 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,366,1526367600"; d="scan'208";a="57569361" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga008.jf.intel.com with ESMTP; 17 Jul 2018 08:41:46 -0700 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 w6HFfjHY017761 for ; Tue, 17 Jul 2018 16:41:45 +0100 Received: from sivswdev01.ir.intel.com (localhost [127.0.0.1]) by sivswdev01.ir.intel.com with ESMTP id w6HFfjxW003600 for ; Tue, 17 Jul 2018 16:41:45 +0100 Received: (from aburakov@localhost) by sivswdev01.ir.intel.com with LOCAL id w6HFfjDW003596 for dev@dpdk.org; Tue, 17 Jul 2018 16:41:45 +0100 From: Anatoly Burakov To: dev@dpdk.org Date: Tue, 17 Jul 2018 16:41:45 +0100 Message-Id: <8308ba8ca44234ec58b36c422ff3bb85117ecd08.1531841506.git.anatoly.burakov@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH] mem: fix static analysis warning 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Technically, single file segments codepath will never get triggered when using in-memory mode, because EAL prohibits mixing these two options at initialization time. However, code analyzers do not know that, and some will complain about either using uninitialized variables, or trying to do operations on an already closed descriptor. Fix this by assuring the compiler or code analyzer that in-memory mode code never gets triggered when using single-file segments mode. Coverity ID: 302847 Fixes: 72b49ff623c4 ("mem: support --in-memory mode") Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_memalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index 79443c56a..a59f229cd 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c @@ -481,7 +481,9 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, void *new_addr; alloc_sz = hi->hugepage_sz; - if (internal_config.in_memory && anonymous_hugepages_supported) { + if (!internal_config.single_file_segments && + internal_config.in_memory && + anonymous_hugepages_supported) { int log2, flags; log2 = rte_log2_u32(alloc_sz);