Commit 2b00d903 authored by Baoquan He's avatar Baoquan He Committed by Ingo Molnar
Browse files

x86/mm: Simplify the pgd_leaf() and p4d_leaf() checks a bit



The functions return bool, simplify the checks.

[ mingo: Split off from two other patches. ]

Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20250331081327.256412-6-bhe@redhat.com
parent c083eff3
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -185,7 +185,7 @@ static p4d_t *pti_user_pagetable_walk_p4d(unsigned long address)

		set_pgd(pgd, __pgd(_KERNPG_TABLE | __pa(new_p4d_page)));
	}
	BUILD_BUG_ON(pgd_leaf(*pgd) != 0);
	BUILD_BUG_ON(pgd_leaf(*pgd));

	return p4d_offset(pgd, address);
}
@@ -206,7 +206,7 @@ static pmd_t *pti_user_pagetable_walk_pmd(unsigned long address)
	if (!p4d)
		return NULL;

	BUILD_BUG_ON(p4d_leaf(*p4d) != 0);
	BUILD_BUG_ON(p4d_leaf(*p4d));
	if (p4d_none(*p4d)) {
		unsigned long new_pud_page = __get_free_page(gfp);
		if (WARN_ON_ONCE(!new_pud_page))