From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2B29321A18AA9 for ; Thu, 6 Apr 2017 06:16:11 -0700 (PDT) Received: by mail-wm0-x229.google.com with SMTP id y18so14258wmh.0 for ; Thu, 06 Apr 2017 06:16:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wBGxrj+uXaMQkdrtDV0kUgo4CGp2R4urP0FQkP5YUXY=; b=GJCNaUaDhwwyJ1EJCuolVcMB2uAslScngA9LgxTwWOtFr435TmuMvu4anOQP4tu4Ya BNy+b3/KRc+Pm8ihGF93Z9DLDoFYwhz2GJR/xcy/cOQW7ekeQ9xuegcsQGuvDhbH017w uN0XvEchpcK8m5x9amWic5IGDqTWVF6hc65wU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wBGxrj+uXaMQkdrtDV0kUgo4CGp2R4urP0FQkP5YUXY=; b=hGiOfvpiHeenyALzgwaUM4DeJeOrrYabnvQBiJvHZ26vi4njKz4Gssln562ZssSvWb hPdCJ71GcFM4vtaI5cjIr8qLZVR9W+2fz4TnJ3ZaMSRewG7SAZ574u37GphFXLhvYuTq E5bZhTrx5wI//VI9jW2+wQJuJo12/xYUN/IB1Gx+AxCsOzSGTkcnbJ6BUlxYTZFLF48q JJxm0XvtVkWiS5MN2HmGQXv4yzMyZ8ELHNaQ9hbtB61Ydto6tj5WJbomWTh82MXVXfNY gxF9H66jH0t6t3XSgDuqLHdf6CEVoGDLvAueaZ4hpf+9vG69VtEosVcQ7OGGippq4PKC 5btQ== X-Gm-Message-State: AFeK/H29OHce7oyUbShv69xM995w+BGr/2QkGb9eiViR+5GYogXlwsUU1IpgqFKlOWnhf5Jn X-Received: by 10.28.66.74 with SMTP id p71mr24455603wma.131.1491484569782; Thu, 06 Apr 2017 06:16:09 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id c8sm2087660wrd.57.2017.04.06.06.16.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:16:09 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org, leif.lindholm@linaro.org, ryan.harkin@linaro.org, evan.lloyd@arm.com, jeremy.linton@arm.com Cc: Ard Biesheuvel Date: Thu, 6 Apr 2017 14:15:48 +0100 Message-Id: <20170406131551.3322-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170406131551.3322-1-ard.biesheuvel@linaro.org> References: <20170406131551.3322-1-ard.biesheuvel@linaro.org> Subject: [PATCH v2 2/5] ArmPlatformPkg/HdLcdArmVExpressLib: fix incorrect FreePool () call X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 Apr 2017 13:16:11 -0000 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 --- ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c index a57846715ed7..67b2f14beee3 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/HdLcdArmVExpressLib/HdLcdArmVExpress.c @@ -146,7 +146,7 @@ LcdPlatformGetVram ( Status = Cpu->SetMemoryAttributes (Cpu, *VramBaseAddress, *VramSize, EFI_MEMORY_UC); ASSERT_EFI_ERROR(Status); if (EFI_ERROR(Status)) { - gBS->FreePool (VramBaseAddress); + gBS->FreePages (*VramBaseAddress, EFI_SIZE_TO_PAGES (*VramSize)); return Status; } -- 2.9.3