mm/memcg: fix a -Wparentheses compilation warning
Subsystems (3)
PATCH 1/1 mm/memcg: fix a -Wparentheses compilation warning
The linux-next commit ("mm/memcontrol.c: fix use after free in mem_cgroup_iter()") [1] introduced a compilation warning,
mm/memcontrol.c:1160:17: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
} while (memcg = parent_mem_cgroup(memcg));
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
mm/memcontrol.c:1160:17: note: place parentheses around the assignment
to silence this warning
} while (memcg = parent_mem_cgroup(memcg));
^
( )
mm/memcontrol.c:1160:17: note: use '==' to turn this assignment into an
equality comparison
} while (memcg = parent_mem_cgroup(memcg));
^
==Fix it by adding a pair of parentheses.
[1] https://lore.kernel.org/linux-mm/[email protected]/
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
@@ -1157,7 +1157,7 @@ static void invalidate_reclaim_iterators(struct mem_cgroup *dead_memcg)do {__invalidate_reclaim_iterators (memcg, dead_memcg); last = memcg; - }while (memcg =parent_mem_cgroup (memcg)); + }while ((memcg =parent_mem_cgroup (memcg)));/* * When cgruop1 non-hierarchy mode is used,
Signature · 1 line
1.8.3.1
Quoted 18 lines · Qian Cai
The linux-next commit ("
mm/memcontrol.c: fix use after free inmem_cgroup_iter()") [1] introduced a compilation warning,
mm/memcontrol.c:1160:17: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]} while (memcg = parent_mem_cgroup(memcg)); ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~ mm/memcontrol.c:1160:17: note: place parentheses around the assignment to silence this warning } while (memcg = parent_mem_cgroup(memcg)); ^ ( ) mm/memcontrol.c:1160:17: note: use '==' to turn this assignment into an equality comparison } while (memcg = parent_mem_cgroup(memcg)); ^ ==
Quoted 5 lines
Fix it by adding a pair of parentheses.
[1] https://lore.kernel.org/linux-mm/[email protected]/
Signed-off-by Qian Cai <[email protected]>
Thanks for the fix. I assume Andrew is going to squash it into the original patch.
Quoted 19 lines
--- mm/memcontrol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/memcontrol.c +1
-1@@ -1157,7 +1157,7 @@ static void invalidate_reclaim_iterators(struct mem_cgroup *dead_memcg)do {__invalidate_reclaim_iterators (memcg, dead_memcg); last = memcg; - }while (memcg =parent_mem_cgroup (memcg)); + }while ((memcg =parent_mem_cgroup (memcg)));/* * When cgruop1 non-hierarchy mode is used, Signature · 1 line
1.8.3.1
Signature · 2 lines
Michal Hocko SUSE Labs