提交 e7bbcdf3 编写于 作者: D Dan Carpenter 提交者: Linus Torvalds

memcontrol: fix potential null deref

There was a potential null deref introduced in c62b1a3b ("memcg: use
generic percpu instead of private implementation").
Signed-off-by: NDan Carpenter <error27@gmail.com>
Acked-by: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9d34706f
......@@ -3691,8 +3691,10 @@ static struct mem_cgroup *mem_cgroup_alloc(void)
else
mem = vmalloc(size);
if (mem)
memset(mem, 0, size);
if (!mem)
return NULL;
memset(mem, 0, size);
mem->stat = alloc_percpu(struct mem_cgroup_stat_cpu);
if (!mem->stat) {
if (size < PAGE_SIZE)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册