summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWang, Yalin <Yalin.Wang@sonymobile.com>2015-02-11 15:24:48 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2015-02-11 17:06:00 -0800
commit1d148e218a0d0566b1c06f2f45f1436d53b049b2 (patch)
tree39e416568334e656764c3a5eab0b5939f6121779
parente4b294c2d8f73af4cd41ff30638ad0e4769dc56a (diff)
downloadop-kernel-dev-1d148e218a0d0566b1c06f2f45f1436d53b049b2.zip
op-kernel-dev-1d148e218a0d0566b1c06f2f45f1436d53b049b2.tar.gz
mm: add VM_BUG_ON_PAGE() to page_mapcount()
Add VM_BUG_ON_PAGE() for slab pages. _mapcount is an union with slab struct in struct page, so we must avoid accessing _mapcount if this page is a slab page. Also remove the unneeded bracket. Signed-off-by: Yalin Wang <yalin.wang@sonymobile.com> Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/mm.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 8dd4fde..c6bf813 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -484,7 +484,8 @@ static inline void page_mapcount_reset(struct page *page)
static inline int page_mapcount(struct page *page)
{
- return atomic_read(&(page)->_mapcount) + 1;
+ VM_BUG_ON_PAGE(PageSlab(page), page);
+ return atomic_read(&page->_mapcount) + 1;
}
static inline int page_count(struct page *page)
OpenPOWER on IntegriCloud