aboutsummaryrefslogtreecommitdiff
path: root/arch/i386/mm/hugetlbpage.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/i386/mm/hugetlbpage.c')
-rw-r--r--arch/i386/mm/hugetlbpage.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/arch/i386/mm/hugetlbpage.c b/arch/i386/mm/hugetlbpage.c
index 57c486f0e89..24c8a536b58 100644
--- a/arch/i386/mm/hugetlbpage.c
+++ b/arch/i386/mm/hugetlbpage.c
@@ -46,8 +46,11 @@ pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
pmd_t *pmd = NULL;
pgd = pgd_offset(mm, addr);
- pud = pud_offset(pgd, addr);
- pmd = pmd_offset(pud, addr);
+ if (pgd_present(*pgd)) {
+ pud = pud_offset(pgd, addr);
+ if (pud_present(*pud))
+ pmd = pmd_offset(pud, addr);
+ }
return (pte_t *) pmd;
}