ArmPlatformPkg/HdLcdArmVExpressLib: fix incorrect FreePool () call

When we fail to modify the memory attributes for the VRAM allocation,
the allocation - which was made using AllocatePages() - is freed using
FreePool(). This is incorrect by itself, but it masks a second bug, i.e.,
that the address of the allocation is not in VramBaseAddress but in
*VramBaseAddress. So fix both issues.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Jeremy Linton <jeremy.linton@arm.com>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
This commit is contained in:
Ard Biesheuvel 2017-04-06 13:06:53 +01:00
parent 1344c8c605
commit e87dca691e
1 changed files with 1 additions and 1 deletions

View File

@ -146,7 +146,7 @@ LcdPlatformGetVram (
Status = Cpu->SetMemoryAttributes (Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC); Status = Cpu->SetMemoryAttributes (Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC);
ASSERT_EFI_ERROR(Status); ASSERT_EFI_ERROR(Status);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
gBS->FreePool (VramBaseAddress); gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize));
return Status; return Status;
} }