From: Arnd Bergmann <arnd@arndb.de>
To: Andrew Morton <akpm@linux-foundation.org>,
Michal Hocko <mhocko@suse.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
Mel Gorman <mgorman@techsingularity.net>,
Vlastimil Babka <vbabka@suse.cz>,
David Rientjes <rientjes@google.com>,
Joonsoo Kim <iamjoonsoo.kim@lge.com>,
Taku Izumi <izumi.taku@jp.fujitsu.com>,
Johannes Weiner <hannes@cmpxchg.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm, compaction: avoid uninitialized variable use
Date: Wed, 11 May 2016 15:24:44 +0200 [thread overview]
Message-ID: <1462973126-1183468-1-git-send-email-arnd@arndb.de> (raw)
A recent rework of the compaction code introduced a warning about
an uninitialized variable when CONFIG_COMPACTION is disabled and
__alloc_pages_direct_compact() does not set its 'compact_result'
output argument:
mm/page_alloc.c: In function '__alloc_pages_nodemask':
mm/page_alloc.c:3651:6: error: 'compact_result' may be used uninitialized in this function [-Werror=maybe-uninitialized]
This adds another check for CONFIG_COMPACTION to ensure we never
evaluate the uninitialized variable in this configuration, which
is probably the simplest way to avoid the warning.
A more elaborate rework might make this more readable.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: 13cff7b81275 ("mm, compaction: simplify __alloc_pages_direct_compact feedback interface")
---
mm/page_alloc.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 477d9382f70d..bedadc686a22 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3640,7 +3640,8 @@ retry:
goto got_pg;
/* Checks for THP-specific high-order allocations */
- if (is_thp_gfp_mask(gfp_mask)) {
+ if (IS_ENABLED(CONFIG_COMPACTION) &&
+ is_thp_gfp_mask(gfp_mask)) {
/*
* If compaction is deferred for high-order allocations, it is
* because sync compaction recently failed. If this is the case
--
2.7.0
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2016-05-11 13:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 13:24 Arnd Bergmann [this message]
2016-05-11 14:44 ` Michal Hocko
2016-05-11 14:52 ` Arnd Bergmann
2016-05-11 16:13 ` Michal Hocko
2016-05-11 14:53 ` Michal Hocko
2016-05-12 6:16 ` Michal Hocko
2016-05-12 12:00 ` Vlastimil Babka
2016-05-12 12:04 ` Arnd Bergmann
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=1462973126-1183468-1-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=hannes@cmpxchg.org \
--cc=iamjoonsoo.kim@lge.com \
--cc=izumi.taku@jp.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=rientjes@google.com \
--cc=vbabka@suse.cz \
/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