Skip to contentSkip to conversation

kpagecount: added slab page checking because of _mapcount in union

PATCH New Petr Holasek 1 participant 1 message Dec 16, 2010 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kpagecount: added slab page checking because of _mapcount in union

PageSlab macro check was added before putting of _mapcount value to /kpagecount. page->_mapcount is in union with SLAB structure so for pages controlled by SLAB page_mapcount() returns nonsenses.

---
 fs/proc/page.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/proc/page.c +1 -1
index 3b8b456..b06c674 100644
@@ -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);

--
1.7.2.3