From 9a2d72365eca6123f780dd4f566d28ed8c1dccc6 Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Mon, 4 Feb 2008 16:48:07 +0100 Subject: [PATCH] --- yaml --- r: 82895 b: refs/heads/master c: 9a14aefc1d28c6037122965ee8c10d92a970ade0 h: refs/heads/master i: 82893: e8743e3ad648569d4eaf8d94f7ec15603946a072 82891: 772fcf6f495a7c9e19ac991ce237674c8b534d01 82887: fab600b8de57d52ea509aff133809b9f04b05c8c 82879: 357b8ba76ebcdb45735786bcaad8282cd20b5c79 v: v3 --- [refs] | 2 +- trunk/arch/x86/mm/pageattr.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 1a057db1a0a1..4ddaf8f3f3c4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 34508f66b69ff1708192654f631eb8f1d4c52005 +refs/heads/master: 9a14aefc1d28c6037122965ee8c10d92a970ade0 diff --git a/trunk/arch/x86/mm/pageattr.c b/trunk/arch/x86/mm/pageattr.c index 3810f7a83b1d..7d21cd658ed3 100644 --- a/trunk/arch/x86/mm/pageattr.c +++ b/trunk/arch/x86/mm/pageattr.c @@ -188,6 +188,14 @@ static inline pgprot_t static_protections(pgprot_t prot, unsigned long address) return prot; } +/* + * Lookup the page table entry for a virtual address. Return a pointer + * to the entry and the level of the mapping. + * + * Note: We return pud and pmd either when the entry is marked large + * or when the present bit is not set. Otherwise we would return a + * pointer to a nonexisting mapping. + */ pte_t *lookup_address(unsigned long address, int *level) { pgd_t *pgd = pgd_offset_k(address); @@ -206,7 +214,7 @@ pte_t *lookup_address(unsigned long address, int *level) return NULL; *level = PG_LEVEL_2M; - if (pmd_large(*pmd)) + if (pmd_large(*pmd) || !pmd_present(*pmd)) return (pte_t *)pmd; *level = PG_LEVEL_4K;