summaryrefslogtreecommitdiffstats
path: root/ArmPkg
diff options
context:
space:
mode:
authorChris Co <Christopher.Co@microsoft.com>2018-04-13 23:43:27 +0000
committerArd Biesheuvel <ard.biesheuvel@linaro.org>2018-06-21 16:09:22 +0200
commit8e586296c114f630188cfe4c76df91a1e2b7a5b2 (patch)
tree40bbfc4da6df1fb4893f20cca28cc4446b0299b9 /ArmPkg
parent6e275c613e15ffc6dc79901fb244e8cb20af9948 (diff)
downloadedk2-8e586296c114f630188cfe4c76df91a1e2b7a5b2.tar.gz
edk2-8e586296c114f630188cfe4c76df91a1e2b7a5b2.tar.bz2
edk2-8e586296c114f630188cfe4c76df91a1e2b7a5b2.zip
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 <leif.lindholm@linaro.org> Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Christopher Co <christopher.co@microsoft.com> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'ArmPkg')
-rw-r--r--ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c2
1 files changed, 1 insertions, 1 deletions
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;