[PATCH 5/8] mm: Fix bug in page flags checking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx>

We need to check the page is initialised before we call compound_head()
on it, or we'll be checking whether the page at -2 has been initialised.

Signed-off-by: Matthew Wilcox <mawilcox@xxxxxxxxxxxxx>
---
 include/linux/page-flags.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h
index a6931046cc5c..c74b880a1b85 100644
--- a/include/linux/page-flags.h
+++ b/include/linux/page-flags.h
@@ -186,13 +186,13 @@ static __always_inline struct page *CheckPageInit(struct page *page)
  *     The page flag is not used for compound pages.
  */
 #define PF_ANY(page, modify)	CheckPageInit(page)
-#define PF_HEAD(page, modify)	CheckPageInit(compound_head(page))
+#define PF_HEAD(page, modify)	compound_head(CheckPageInit(page))
 #define PF_ONLY_HEAD(page, modify) ({					\
 		VM_BUG_ON_PGFLAGS(PageTail(page), page);		\
 		CheckPageInit(page); })
 #define PF_TAIL_READ(page, modify) ({					\
 		VM_BUG_ON_PGFLAGS(modify && PageTail(page), page);	\
-		CheckPageInit(compound_head(page)); })
+		compound_head(CheckPageInit(page)); })
 #define PF_NO_COMPOUND(page, modify) ({				\
 		VM_BUG_ON_PGFLAGS(modify && PageCompound(page), page);	\
 		CheckPageInit(page); })
-- 
2.16.3




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux