From: KOSAKI Motohiro Date: Thu, 8 Jan 2009 02:08:18 +0000 (-0800) Subject: memcg: add null check to page_cgroup_zoneinfo() X-Git-Tag: v2.6.29-rc1~111 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=549927620b04a8f8073ce2ee2a8977f209af2ee5;p=linux-2.6-omap-h63xx.git memcg: add null check to page_cgroup_zoneinfo() If CONFIG_CGROUP_MEM_RES_CTLR_SWAP=y, page_cgroup::mem_cgroup can be NULL. Therefore null checking is better. A later patch uses this function. Acked-by: KAMEZAWA Hiroyuki Acked-by: Rik van Riel Signed-off-by: KOSAKI Motohiro Cc: Balbir Singh Cc: Daisuke Nishimura Cc: Hugh Dickins Cc: KOSAKI Motohiro Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 9b4993ee46b..457d671029b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -231,6 +231,9 @@ page_cgroup_zoneinfo(struct page_cgroup *pc) int nid = page_cgroup_nid(pc); int zid = page_cgroup_zid(pc); + if (!mem) + return NULL; + return mem_cgroup_zoneinfo(mem, nid, zid); }