memalloc: fix variable shadowing

Message ID cb53f2d82f0fe5a2c1533afc6b789ad0ebaae6fc.1546964368.git.anatoly.burakov@intel.com
State Accepted, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • memalloc: fix variable shadowing
Related show

Checks

Context Check Description
ci/Intel-compilation success Compilation OK
ci/intel-Performance-Testing success Performance Testing PASS
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Burakov, Anatoly Jan. 8, 2019, 4:33 p.m.
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 <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_memalloc.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Thomas Monjalon Jan. 14, 2019, 2:38 p.m. | #1
08/01/2019 17:33, Anatoly Burakov:
> 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 <anatoly.burakov@intel.com>

Applied, thanks

Patch

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