Skip to content

Commit eed67d7

Browse files
Ross Zwislerhtejun
authored andcommitted
cgroup: Fix uninitialized variable warning
Commit 1f7dd3e ("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: Ross Zwisler <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 6bf024e commit eed67d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mm/memcontrol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4782,7 +4782,7 @@ static void mem_cgroup_clear_mc(void)
47824782
static int mem_cgroup_can_attach(struct cgroup_taskset *tset)
47834783
{
47844784
struct cgroup_subsys_state *css;
4785-
struct mem_cgroup *memcg;
4785+
struct mem_cgroup *memcg = NULL; /* unneeded init to make gcc happy */
47864786
struct mem_cgroup *from;
47874787
struct task_struct *leader, *p;
47884788
struct mm_struct *mm;

0 commit comments

Comments
 (0)