提交 eed67d75 编写于 作者: R Ross Zwisler 提交者: Tejun Heo

cgroup: Fix uninitialized variable warning

Commit 1f7dd3e5 ("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.

This was found using gcc (GCC) 4.9.2 20150212 (Red Hat 4.9.2-6).
Signed-off-by: NRoss Zwisler <ross.zwisler@linux.intel.com>
Signed-off-by: NTejun Heo <tj@kernel.org>
上级 6bf024e6
...@@ -4782,7 +4782,7 @@ static void mem_cgroup_clear_mc(void) ...@@ -4782,7 +4782,7 @@ static void mem_cgroup_clear_mc(void)
static int mem_cgroup_can_attach(struct cgroup_taskset *tset) static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
{ {
struct cgroup_subsys_state *css; struct cgroup_subsys_state *css;
struct mem_cgroup *memcg; struct mem_cgroup *memcg = NULL; /* unneeded init to make gcc happy */
struct mem_cgroup *from; struct mem_cgroup *from;
struct task_struct *leader, *p; struct task_struct *leader, *p;
struct mm_struct *mm; struct mm_struct *mm;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册