From patchwork Thu Apr 6 13:15:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 96959 Delivered-To: patch@linaro.org Received: by 10.140.89.233 with SMTP id v96csp726402qgd; Thu, 6 Apr 2017 06:16:17 -0700 (PDT) X-Received: by 10.98.223.133 with SMTP id d5mr12925447pfl.222.1491484577485; Thu, 06 Apr 2017 06:16:17 -0700 (PDT) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id h1si1843106pfg.225.2017.04.06.06.16.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:16:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; 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 2001:19d0:306:5::1 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 2D49721A0480E; Thu, 6 Apr 2017 06:16:15 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wr0-x22c.google.com (mail-wr0-x22c.google.com [IPv6:2a00:1450:400c:c0c::22c]) (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 9833521A0480E for ; Thu, 6 Apr 2017 06:16:13 -0700 (PDT) Received: by mail-wr0-x22c.google.com with SMTP id t20so61702279wra.1 for ; Thu, 06 Apr 2017 06:16:13 -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=FmqolnnYwGoGv5HaGK9zKXUVK4PFXtsvwaBl8IkU4mc=; b=O4pwHuD4J2ZxJ/mGGSFL+A5v82ooDj38Vmr7g7NaIpz4CFjKEf6V2Ja+MohjKUwmka eA2vzXq9p6yPWmKPeUVAEZ9fcYHoZjo6XHeQ7noUxzTEQSddr6Cm8ityfVcxRnyTlV39 UpZggFfAZAVat6ip6H63DRW6b3bIgfmDjttfc= 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=FmqolnnYwGoGv5HaGK9zKXUVK4PFXtsvwaBl8IkU4mc=; b=Yeb8b6eLKMkc/QAo7LaBkU59Z2TmndgGqAsvwkQEtz5z9UUFlsWdNHAQ4nVYUmIMeu mTz1Vb3aT+E/1xt1Oq+nhs0Qymg5CWPg7neVElmSH3E0IzVeZhgWSnAyBJwL988110s5 Cl/gUSJHGbtWwGhKOVvdPWCW+aIhLWwx1Bn0IGa/bV0NaQplIpXe2LgzaLkpXp4jlgtu qBY3AIByiVsZbAiKhSa10wlrRKFsBDHl2vSZbXdBwyFIz/ql4MQkXV1oKdWbU5ELUtcP YxKgYD1Pdy+gWG+xYwvuizlHBRZeRGWPRtB5k+z6UkeESDUs2RrSgiguNeILvmf0hcx1 YtKg== X-Gm-Message-State: AFeK/H1906Tw8XlXFIUJE3K+2PMMKuoHFMe3qQwnePV2FzcNHRuMmCfOwbdB6BRGRsMQHGxj X-Received: by 10.223.171.84 with SMTP id r20mr28233947wrc.159.1491484572116; Thu, 06 Apr 2017 06:16:12 -0700 (PDT) Received: from localhost.localdomain ([160.163.145.113]) by smtp.gmail.com with ESMTPSA id c8sm2087660wrd.57.2017.04.06.06.16.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Apr 2017 06:16:11 -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:49 +0100 Message-Id: <20170406131551.3322-4-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 3/5] ArmPlatformPkg/PL111LcdArmVExpressLib: 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/PL111LcdArmVExpressLib/PL111LcdArmVExpress.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/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c index 2000c9bdf436..a8125e81daac 100644 --- a/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c +++ b/ArmPlatformPkg/ArmVExpressPkg/Library/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c @@ -195,7 +195,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; } break;