From 8e586296c114f630188cfe4c76df91a1e2b7a5b2 Mon Sep 17 00:00:00 2001 From: Chris Co Date: Fri, 13 Apr 2018 23:43:27 +0000 Subject: ArmPkg/ArmMmuLib ARM: fix Mva to use idx instead of table base Mva address calculation should use the left-shifted current section index instead of the left-shifted table base address. Using the table base address here has the side-effect of potentially causing an access violation depending on the base address value. Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co Reviewed-by: Ard Biesheuvel --- ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ArmPkg') diff --git a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c index 33dd2b173e..ec51e072ab 100644 --- a/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c +++ b/ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c @@ -702,7 +702,7 @@ UpdateSectionEntries ( Descriptor |= EntryValue; if (CurrentDescriptor != Descriptor) { - Mva = (VOID *)(UINTN)(((UINTN)FirstLevelTable) << TT_DESCRIPTOR_SECTION_BASE_SHIFT); + Mva = (VOID *)(UINTN)(((UINTN)FirstLevelIdx + i) << TT_DESCRIPTOR_SECTION_BASE_SHIFT); // Only need to update if we are changing the descriptor FirstLevelTable[FirstLevelIdx + i] = Descriptor; -- cgit v1.2.3