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>
This commit is contained in:
Chris Co 2018-04-13 23:43:27 +00:00 committed by Ard Biesheuvel
parent 6e275c613e
commit 8e586296c1
1 changed files with 1 additions and 1 deletions

View File

@ -702,7 +702,7 @@ UpdateSectionEntries (
Descriptor |= EntryValue; Descriptor |= EntryValue;
if (CurrentDescriptor != Descriptor) { 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 // Only need to update if we are changing the descriptor
FirstLevelTable[FirstLevelIdx + i] = Descriptor; FirstLevelTable[FirstLevelIdx + i] = Descriptor;