Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1638594

[PATCH] mm/vmscan: fix unsequenced modification and access warning

From Nick Desaulniers <nick.desaulniers@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] mm/vmscan: fix unsequenced modification and access warning
Date 2017-05-10 09:00 +0200
Message-ID <tFtLk-5MF-19@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

[PATCH] mm/vmscan: fix unsequenced modification and access warning Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-10 09:00 +0200
  Re: [PATCH] mm/vmscan: fix unsequenced modification and access  warning Michal Hocko <mhocko@kernel.org> - 2017-05-10 09:20 +0200
    [Patch v2] mm/vmscan: fix unsequenced modification and access warning Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-10 10:30 +0200
      Re: [Patch v2] mm/vmscan: fix unsequenced modification and access  warning Michal Hocko <mhocko@kernel.org> - 2017-05-10 10:40 +0200
    Re: [PATCH] mm/vmscan: fix unsequenced modification and access  warning Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-10 10:50 +0200
      Re: [PATCH] mm/vmscan: fix unsequenced modification and access  warning Michal Hocko <mhocko@kernel.org> - 2017-05-10 11:30 +0200
        [Patch v3] mm/vmscan: fix unsequenced modification and access warning Nick Desaulniers <nick.desaulniers@gmail.com> - 2017-05-10 17:50 +0200

csiph-web