DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org
Subject: [dpdk-dev] [PATCH] memalloc: fix variable shadowing
Date: Tue,  8 Jan 2019 16:33:59 +0000	[thread overview]
Message-ID: <cb53f2d82f0fe5a2c1533afc6b789ad0ebaae6fc.1546964368.git.anatoly.burakov@intel.com> (raw)

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(-)

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

             reply	other threads:[~2019-01-08 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-08 16:33 Anatoly Burakov [this message]
2019-01-14 14:38 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cb53f2d82f0fe5a2c1533afc6b789ad0ebaae6fc.1546964368.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).