From f07c40a0e06fd1161ca4dd1016814504f5e0504a Mon Sep 17 00:00:00 2001 From: Andrew Cooper Date: Thu, 8 Sep 2016 12:46:05 +0100 Subject: [PATCH] Appropriately mask out the address and flags parameters when constructing a pte Signed-off-by: Andrew Cooper --- include/arch/x86/pagetable.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/arch/x86/pagetable.h b/include/arch/x86/pagetable.h index aa5ab82..4e7b9a3 100644 --- a/include/arch/x86/pagetable.h +++ b/include/arch/x86/pagetable.h @@ -12,7 +12,8 @@ static inline paddr_t pte_to_paddr(intpte_t pte) static inline intpte_t pte_from_paddr(paddr_t paddr, uint64_t flags) { - return paddr | flags; + return ((paddr & (PADDR_MASK & PAGE_MASK)) | + (flags & ~(PADDR_MASK & PAGE_MASK))); } static inline intpte_t pte_from_gfn(unsigned long gfn, uint64_t flags) -- 2.39.5