From: Aneesh Kumar K.V Date: Tue, 5 May 2020 07:17:26 +0000 (+0530) Subject: powerpc/kvm/book3s: Use pte_present instead of opencoding _PAGE_PRESENT check X-Git-Tag: v5.15~3690^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0e11df9649ac4251c1bc5f27b7d89636d9270a91;p=platform%2Fkernel%2Flinux-starfive.git powerpc/kvm/book3s: Use pte_present instead of opencoding _PAGE_PRESENT check This adds _PAGE_PTE check and makes sure we validate the pte value returned via find_kvm_host_pte. NOTE: this also considers _PAGE_INVALID to the software valid bit. Signed-off-by: Aneesh Kumar K.V Signed-off-by: Michael Ellerman Link: https://lore.kernel.org/r/20200505071729.54912-20-aneesh.kumar@linux.ibm.com --- diff --git a/arch/powerpc/include/asm/kvm_book3s_64.h b/arch/powerpc/include/asm/kvm_book3s_64.h index 1ca1f64..c58e64a 100644 --- a/arch/powerpc/include/asm/kvm_book3s_64.h +++ b/arch/powerpc/include/asm/kvm_book3s_64.h @@ -435,7 +435,7 @@ static inline pte_t kvmppc_read_update_linux_pte(pte_t *ptep, int writing) continue; } /* If pte is not present return None */ - if (unlikely(!(pte_val(old_pte) & _PAGE_PRESENT))) + if (unlikely(!pte_present(old_pte))) return __pte(0); new_pte = pte_mkyoung(old_pte);