From 199629022c5832f72431570d4f9d615f7a90f2ca Mon Sep 17 00:00:00 2001 From: Anatoly Burakov Date: Tue, 8 Jan 2019 16:33:59 +0000 Subject: [PATCH] mem: fix variable shadowing 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 | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/librte_eal/linuxapp/eal/eal_memalloc.c b/lib/librte_eal/linuxapp/eal/eal_memalloc.c index 60a0a680f6..5b421f1d70 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; + const int in_memory_flags = MAP_HUGETLB | MAP_FIXED | + MAP_PRIVATE | MAP_ANONYMOUS; + int pagesz_flag; pagesz_flag = pagesz_flags(alloc_sz); - flags = pagesz_flag | MAP_HUGETLB | MAP_FIXED | - MAP_PRIVATE | MAP_ANONYMOUS; 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.20.1