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 DF9451B54E; Tue, 8 Jan 2019 17:34:01 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jan 2019 08:34:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.56,454,1539673200"; d="scan'208";a="124309351" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.fm.intel.com with ESMTP; 08 Jan 2019 08:34:00 -0800 Received: from sivswdev05.ir.intel.com (sivswdev05.ir.intel.com [10.243.17.64]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id x08GXxV5029088; Tue, 8 Jan 2019 16:33:59 GMT Received: from sivswdev05.ir.intel.com (localhost [127.0.0.1]) by sivswdev05.ir.intel.com with ESMTP id x08GXxFo032272; Tue, 8 Jan 2019 16:33:59 GMT Received: (from aburakov@localhost) by sivswdev05.ir.intel.com with LOCAL id x08GXxXW032268; Tue, 8 Jan 2019 16:33:59 GMT From: Anatoly Burakov To: dev@dpdk.org Cc: stable@dpdk.org Date: Tue, 8 Jan 2019 16:33:59 +0000 Message-Id: X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-stable] [PATCH] memalloc: fix variable shadowing 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: Tue, 08 Jan 2019 16:34:02 -0000 A local variable ``flags`` was shadowing another variable from outer scope. Fix this by renaming the variable and make it const. Fixes: c127be93f619 ("mem: support using memfd segments for in-memory mode") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov --- lib/librte_eal/linuxapp/eal/eal_memalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index 60a0a680f..5b421f1d7 100644 --- a/lib/librte_eal/linuxapp/eal/eal_memalloc.c +++ b/lib/librte_eal/linuxapp/eal/eal_memalloc.c @@ -621,13 +621,13 @@ alloc_seg(struct rte_memseg *ms, void *addr, int socket_id, int mmap_flags; if (internal_config.in_memory && !memfd_create_supported) { - int pagesz_flag, flags; - - pagesz_flag = pagesz_flags(alloc_sz); - flags = pagesz_flag | MAP_HUGETLB | MAP_FIXED | + const int in_memory_flags = MAP_HUGETLB | MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS; + int pagesz_flag; + + pagesz_flag = pagesz_flags(alloc_sz); fd = -1; - mmap_flags = flags; + mmap_flags = in_memory_flags | pagesz_flag; /* single-file segments codepath will never be active * here because in-memory mode is incompatible with the -- 2.17.1