From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: Ard Biesheuvel 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: [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: , X-List-Received-Date: Thu, 06 Apr 2017 13:16:14 -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/PL111LcdArmVExpressLib/PL111LcdArmVExpress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.9.3