]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/HdLcdArmVExpressLib: fix incorrect FreePool () call
authorArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 6 Apr 2017 12:06:53 +0000 (13:06 +0100)
committerArd Biesheuvel <ard.biesheuvel@linaro.org>
Thu, 6 Apr 2017 20:31:48 +0000 (21:31 +0100)
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>
ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c

index a57846715ed7742ed0acb7ecf87e98fb471925a1..67b2f14beee3b42dbb59a14d93cdb145f34bdad2 100644 (file)
@@ -146,7 +146,7 @@ LcdPlatformGetVram (
   Status = Cpu->SetMemoryAttributes (Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC);\r
   ASSERT_EFI_ERROR(Status);\r
   if (EFI_ERROR(Status)) {\r
-    gBS->FreePool (VramBaseAddress);\r
+    gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize));\r
     return Status;\r
   }\r
 \r