]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPkg/ArmMmuLib ARM: fix Mva to use idx instead of table base
authorChris Co <Christopher.Co@microsoft.com>
Fri, 13 Apr 2018 23:43:27 +0000 (23:43 +0000)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 21 Jun 2018 14:09:22 +0000 (16:09 +0200)
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>
ArmPkg/Library/ArmMmuLib/Arm/ArmMmuLibCore.c

index 33dd2b173eaab8e7f310a4a9c397d577c4e4269c..ec51e072ab43571dde03f29ff529643a7fc6dc07 100644 (file)
@@ -702,7 +702,7 @@ UpdateSectionEntries (
       Descriptor |= EntryValue;\r
 \r
       if (CurrentDescriptor  != Descriptor) {\r
-        Mva = (VOID *)(UINTN)(((UINTN)FirstLevelTable) << TT_DESCRIPTOR_SECTION_BASE_SHIFT);\r
+        Mva = (VOID *)(UINTN)(((UINTN)FirstLevelIdx + i) << TT_DESCRIPTOR_SECTION_BASE_SHIFT);\r
 \r
         // Only need to update if we are changing the descriptor\r
         FirstLevelTable[FirstLevelIdx + i] = Descriptor;\r