[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b2eb1c06-eb7c-8cfc-6cc8-9c66cf396813@redhat.com>
Date: Wed, 6 May 2020 21:49:15 -0400
From: Lenny Szubowicz <lszubowi@...hat.com>
To: Ard Biesheuvel <ardb@...nel.org>
Cc: eric.snowberg@...cle.com, Ingo Molnar <mingo@...nel.org>,
Arvind Sankar <nivedita@...m.mit.edu>,
Thomas Gleixner <tglx@...utronix.de>,
linux-efi <linux-efi@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] efi/libstub/x86: Free EFI map buffer in allocate_e820()
On 5/6/20 3:23 AM, Ard Biesheuvel wrote:
> On Tue, 5 May 2020 at 21:00, Lenny Szubowicz <lszubowi@...hat.com> wrote:
>>
>> 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 <lszubowi@...hat.com>
>> ---
>> 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);
>> +
>
> Wouldn't it be better to call BS->GetMemoryMap() directly here, with a
> zero size for the input buffer?
I agree, that's a good suggestion. V2 coming shortly after testing.
>
>> nr_desc = buff_size / desc_size;
>>
>> if (nr_desc > ARRAY_SIZE(params->e820_table)) {
>> --
>> 2.18.4
>>
>
Powered by blists - more mailing lists