From: Petr Holasek Date: Thu, 13 Jan 2011 01:00:34 +0000 (-0800) Subject: kpagecount: add slab page checking because _mapcount is in a union X-Git-Tag: v2.6.38-rc1~312 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a6fc86d2b43bf1086557f023a24adf91db915559;p=thirdparty%2Fkernel%2Flinux.git kpagecount: add slab page checking because _mapcount is in a union Add a PageSlab() check before adding the _mapcount value to /kpagecount. page->_mapcount is in a union with the SLAB structure so for pages controlled by SLAB, page_mapcount() returns nonsense. Signed-off-by: Petr Holasek Cc: Wu Fengguang Cc: Matt Mackall Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/proc/page.c b/fs/proc/page.c index 3b8b456603318..b06c674624e6a 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -40,7 +40,7 @@ static ssize_t kpagecount_read(struct file *file, char __user *buf, ppage = pfn_to_page(pfn); else ppage = NULL; - if (!ppage) + if (!ppage || PageSlab(ppage)) pcount = 0; else pcount = page_mapcount(ppage);