Skip to content

Commit bfb1d2b

Browse files
Ryan Robertsctmarinas
authored andcommitted
arm64/mm: Check PUD_TYPE_TABLE in pud_bad()
pud_bad() is currently defined in terms of pud_table(). Although for some configs, pud_table() is hard-coded to true i.e. when using 64K base pages or when page table levels are less than 3. pud_bad() is intended to check that the pud is configured correctly. Hence let's open-code the same check that the full version of pud_table() uses into pud_bad(). Then it always performs the check regardless of the config. Cc: Will Deacon <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Mark Rutland <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Ryan Roberts <[email protected]> Signed-off-by: Anshuman Khandual <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 4fa8a9c commit bfb1d2b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/include/asm/pgtable.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,8 @@ static inline unsigned long pmd_page_vaddr(pmd_t pmd)
827827
pr_err("%s:%d: bad pmd %016llx.\n", __FILE__, __LINE__, pmd_val(e))
828828

829829
#define pud_none(pud) (!pud_val(pud))
830-
#define pud_bad(pud) (!pud_table(pud))
830+
#define pud_bad(pud) ((pud_val(pud) & PUD_TYPE_MASK) != \
831+
PUD_TYPE_TABLE)
831832
#define pud_present(pud) pte_present(pud_pte(pud))
832833
#ifndef __PAGETABLE_PMD_FOLDED
833834
#define pud_leaf(pud) (pud_present(pud) && !pud_table(pud))

0 commit comments

Comments
 (0)