From patchwork Thu Apr 6 13:15:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96958 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp726376qgd; Thu, 6 Apr 2017 06:16:15 -0700 (PDT) X-Received: by 10.84.214.15 with SMTP id h15mr2182850pli.65.1491484575030; Thu, 06 Apr 2017 06:16:15 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id 31si1858403plz.70.2017.04.06.06.16.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:16:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E405821DFA903; Thu, 6 Apr 2017 06:16:11 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org 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 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: [edk2] [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: , Cc: Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" 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(-) -- 2.9.3 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel 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; }