Commit 1f7dd3e5a6e4 ("cgroup: fix handling of multi-destination migration from subtree_control enabling") introduced the following compiler warning: mm/memcontrol.c: In function ‘mem_cgroup_can_attach’: mm/memcontrol.c:4790:9: warning: ‘memcg’ may be used uninitialized in this function [-Wmaybe-uninitialized] mc.to = memcg; ^ Fix this by initializing 'memcg' to NULL and then verifying that it is set to a value before dereferencing it. Signed-off-by: Ross Zwisler <ross.zwisler@xxxxxxxxxxxxxxx> --- This issue is present in v4.4-rc5 and later. --- mm/memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index e234c21..69a28b3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -4782,7 +4782,7 @@ static void mem_cgroup_clear_mc(void) static int mem_cgroup_can_attach(struct cgroup_taskset *tset) { struct cgroup_subsys_state *css; - struct mem_cgroup *memcg; + struct mem_cgroup *memcg = NULL; struct mem_cgroup *from; struct task_struct *leader, *p; struct mm_struct *mm; @@ -4805,7 +4805,7 @@ static int mem_cgroup_can_attach(struct cgroup_taskset *tset) p = leader; memcg = mem_cgroup_from_css(css); } - if (!p) + if (!p || !memcg) return 0; /* -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html