linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/vmscan: fix unsequenced modification and access warning
@ 2017-05-10  6:53 Nick Desaulniers
  2017-05-10  7:15 ` Michal Hocko
  0 siblings, 1 reply; 13+ messages in thread
From: Nick Desaulniers @ 2017-05-10  6:53 UTC (permalink / raw)
  Cc: akpm, hannes, mgorman, mhocko, vbabka, minchan, linux-mm,
	linux-kernel, Nick Desaulniers

Clang flags this file with the -Wunsequenced error that GCC does not
have.

unsequenced modification and access to 'gfp_mask'

It seems that gfp_mask is both read and written without a sequence point
in between, which is undefined behavior.

Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>
---
 mm/vmscan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 4e7ed65842af..74785908822c 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -2958,7 +2958,7 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
 	unsigned long nr_reclaimed;
 	struct scan_control sc = {
 		.nr_to_reclaim = SWAP_CLUSTER_MAX,
-		.gfp_mask = (gfp_mask = current_gfp_context(gfp_mask)),
+		.gfp_mask = current_gfp_context(gfp_mask),
 		.reclaim_idx = gfp_zone(gfp_mask),
 		.order = order,
 		.nodemask = nodemask,
@@ -2968,6 +2968,8 @@ unsigned long try_to_free_pages(struct zonelist *zonelist, int order,
 		.may_swap = 1,
 	};
 
+	gfp_mask = sc.gfp_mask;
+
 	/*
 	 * Do not enter reclaim if fatal signal was delivered while throttled.
 	 * 1 is returned so that the page allocator does not OOM kill at this
-- 
2.11.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>

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-03-22  9:50 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-10  6:53 [PATCH] mm/vmscan: fix unsequenced modification and access warning Nick Desaulniers
2017-05-10  7:15 ` Michal Hocko
2017-05-10  8:27   ` [Patch v2] " Nick Desaulniers
2017-05-10  8:38     ` Michal Hocko
2017-05-16  8:27       ` Michal Hocko
2017-05-17  3:01         ` Nick Desaulniers
2017-05-26  4:43         ` Nick Desaulniers
2017-05-31 15:21           ` Michal Hocko
2017-05-10  8:46   ` [PATCH] " Nick Desaulniers
2017-05-10  9:25     ` Michal Hocko
2017-05-10 15:40       ` [Patch v3] " Nick Desaulniers
2018-03-21 21:37   ` [PATCH] " Nick Desaulniers
2018-03-22  9:50     ` Michal Hocko

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