Instead of using hard-coded integer in effective_prot_pXd(), use pgtable level enum.
There should be no functional change. Signed-off-by: Yeoreum Yun <[email protected]> --- arch/x86/mm/dump_pagetables.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c index 2afa7a23340e..a18a61e732c3 100644 --- a/arch/x86/mm/dump_pagetables.c +++ b/arch/x86/mm/dump_pagetables.c @@ -248,13 +248,13 @@ static void note_wx(struct pg_state *st, unsigned long addr) (void *)st->start_address); } -static void effective_prot(struct ptdump_state *pt_st, int level, u64 val) +static void effective_prot(struct ptdump_state *pt_st, enum pgtable_level level, u64 val) { struct pg_state *st = container_of(pt_st, struct pg_state, ptdump); pgprotval_t prot = val & PTE_FLAGS_MASK; pgprotval_t effective; - if (level > 0) { + if (level > PGTABLE_LEVEL_PGD) { pgprotval_t higher_prot = st->prot_levels[level - 1]; effective = (higher_prot & prot & (_PAGE_USER | _PAGE_RW)) | @@ -268,27 +268,27 @@ static void effective_prot(struct ptdump_state *pt_st, int level, u64 val) static void effective_prot_pte(struct ptdump_state *st, pte_t pte) { - effective_prot(st, 4, pte_val(pte)); + effective_prot(st, PGTABLE_LEVEL_PTE, pte_val(pte)); } static void effective_prot_pmd(struct ptdump_state *st, pmd_t pmd) { - effective_prot(st, 3, pmd_val(pmd)); + effective_prot(st, PGTABLE_LEVEL_PMD, pmd_val(pmd)); } static void effective_prot_pud(struct ptdump_state *st, pud_t pud) { - effective_prot(st, 2, pud_val(pud)); + effective_prot(st, PGTABLE_LEVEL_PUD, pud_val(pud)); } static void effective_prot_p4d(struct ptdump_state *st, p4d_t p4d) { - effective_prot(st, 1, p4d_val(p4d)); + effective_prot(st, PGTABLE_LEVEL_P4D, p4d_val(p4d)); } static void effective_prot_pgd(struct ptdump_state *st, pgd_t pgd) { - effective_prot(st, 0, pgd_val(pgd)); + effective_prot(st, PGTABLE_LEVEL_PGD, pgd_val(pgd)); } -- 2.43.0

