Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp1046454ybj; Tue, 5 May 2020 12:02:19 -0700 (PDT) X-Google-Smtp-Source: APiQypLPh74vA6EsDpKEGPhJag90r8oV5Hza9jGBlEggrnyTA9GyU8WGE6qECSUp+jTuGvMDrAdr X-Received: by 2002:a05:6402:3121:: with SMTP id dd1mr4018647edb.168.1588705338805; Tue, 05 May 2020 12:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588705338; cv=none; d=google.com; s=arc-20160816; b=mlr7A9gnuBfP0qFatOpAsVydGmBQ8IauukKEyR2It36ZsLDxNeIh8NRELvomlScMsh pRyswTZdh605jpRsy3hza6fGxqlV3BB+PQzf50tgXd8FmJ43PuNapTa3CmTDLFma9y8U uQRET0SFm4DnjGT4dBFuE9w3mcncwPWbFOXNttHHPrwwg3ETQuQUZp5zt7f3CCXdT645 zUdmy7K4D0LSlXROumMP7BNC9/B9ST6C4Sz/EBz4LjaKkDltICnbtSyRW3yu+inoqEFw T5YnMbOMHrLu6izIRAAovO938TSIZWO0FoBfUJ5D9432P114nWbngcFezFSM/QTar8BZ PIjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature; bh=R7YqtoNVOAoFKS6RM3wllcWxnGsaIeVUvLmMoQN3l6s=; b=hNWPs+MhwkhJD2HlK19c32Cg/oArHl3Qreuo4KnUMKko9ee/ybCj27VKxWROvD+y/3 N3VQr+N2r9EGqV2+8dcHU2U8XekaJRcX92cBHTKgzCg8dvxdt3Y2gSyuQ6bZxMkrnTxX a+XWNO8uOuIjExgeYSx/nfIM4FjW2tMKcYVEMRGMwrLYolGR3oWq6/hbIM0PrZ7wOE71 qxUeby8nZQti77KjjHykRBaGwVwIe/RDn3FC0nblhI59Ugk8pHBBFPzE/gXRDcJc5dNR Aym5X4E1CKQzcvLaHMey22Y+WlAReHPBUsSK8eW1PlJlBwG2eTj/puB5hHgiEYFepf8G w+Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VN2sk+fu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si1718382ejb.387.2020.05.05.12.01.55; Tue, 05 May 2020 12:02:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=VN2sk+fu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729037AbgEETAZ (ORCPT + 99 others); Tue, 5 May 2020 15:00:25 -0400 Received: from us-smtp-1.mimecast.com ([205.139.110.61]:40314 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728481AbgEETAZ (ORCPT ); Tue, 5 May 2020 15:00:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588705224; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=R7YqtoNVOAoFKS6RM3wllcWxnGsaIeVUvLmMoQN3l6s=; b=VN2sk+fuJdiPCK3DG8DTXvA0TQhVDkdF3M5DCCfu+vSBzP+LLEeqiN2gzaEQ0w72pT6/3S I9SCVM+sxkVkr8yQxe9R1ovDpwh51RUw9RBVVGCMlUxTdaqkSMmmB38ld3LmoN1ClukNpe c1KPdu5fRLkPxs7Q7LbUhTEDHQHLo/Q= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-316-QjKGPL5FP2uTIWb7k7g_vw-1; Tue, 05 May 2020 15:00:20 -0400 X-MC-Unique: QjKGPL5FP2uTIWb7k7g_vw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D1AE91899527; Tue, 5 May 2020 19:00:18 +0000 (UTC) Received: from lszubowi.redhat.com (unknown [10.10.110.69]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8A51F19C4F; Tue, 5 May 2020 19:00:17 +0000 (UTC) From: Lenny Szubowicz To: ardb@kernel.org, eric.snowberg@oracle.com, mingo@kernel.org, nivedita@alum.mit.edu, tglx@linutronix.de, linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] efi/libstub/x86: Free EFI map buffer in allocate_e820() Date: Tue, 5 May 2020 15:00:16 -0400 Message-Id: <20200505190016.4350-1-lszubowi@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In allocate_e820(), free the EFI map buffer that has been returned by efi_get_memory_map(). The returned size of the EFI map buffer is used to allocate an adequately sized e820ext buffer, if it's needed. But the contents of that EFI map buffer is not used at all and the local pointer to it is gone on return from allocate_e820(). Signed-off-by: Lenny Szubowicz --- drivers/firmware/efi/libstub/x86-stub.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c index 05ccb229fb45..4efe3e7a218d 100644 --- a/drivers/firmware/efi/libstub/x86-stub.c +++ b/drivers/firmware/efi/libstub/x86-stub.c @@ -623,6 +623,9 @@ static efi_status_t allocate_e820(struct boot_params *params, if (status != EFI_SUCCESS) return status; + /* Allocated EFI map buf is not used here. Just need its size. */ + efi_bs_call(free_pool, map); + nr_desc = buff_size / desc_size; if (nr_desc > ARRAY_SIZE(params->e820_table)) { -- 2.18.4