From ab7b02ce679764c0b09b42c7a9b19f2f53e122ea Mon Sep 17 00:00:00 2001 From: Adithya Baglody Date: Wed, 9 Aug 2017 12:23:00 +0530 Subject: [PATCH] x86: MMU: Bug in _x86_mmu_buffer_validate The value of the PTE (starting_pte_num) was not calulated correctly. If size of the buffer exceeded 4KB, the buffer validation API was failing. JIRA: ZEP-2489 Signed-off-by: Adithya Baglody --- arch/x86/core/x86_mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/core/x86_mmu.c b/arch/x86/core/x86_mmu.c index 3523a1e5288..0538f1e6d46 100644 --- a/arch/x86/core/x86_mmu.c +++ b/arch/x86/core/x86_mmu.c @@ -143,7 +143,7 @@ int _x86_mmu_buffer_validate(void *addr, size_t size, int flags) end_pde_num = MMU_PDE_NUM((char *)addr + size - 1); rw_permission = GET_RW_PERM(flags); us_permission = GET_US_PERM(flags); - starting_pte_num = MMU_PAGE_NUM((char *)addr + size - 1); + starting_pte_num = MMU_PAGE_NUM((char *)addr); /* Iterate for all the pde's the buffer might take up. * (depends on the size of the buffer and start address of the buff)