mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lenny Szubowicz <lszubowi@redhat.com>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: eric.snowberg@oracle.com, Ingo Molnar <mingo@kernel.org>,
	Arvind Sankar <nivedita@alum.mit.edu>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-efi <linux-efi@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] efi/libstub/x86: Free EFI map buffer in allocate_e820()
Date: Wed, 6 May 2020 21:49:15 -0400	[thread overview]
Message-ID: <b2eb1c06-eb7c-8cfc-6cc8-9c66cf396813@redhat.com> (raw)
In-Reply-To: <CAMj1kXHsvy09V0rK2Qh0eiR4Vi5ZDn=5ordNvEBH4c-Xk00QgQ@mail.gmail.com>

On 5/6/20 3:23 AM, Ard Biesheuvel wrote:
> On Tue, 5 May 2020 at 21:00, Lenny Szubowicz <lszubowi@redhat.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@redhat.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
>>
> 


      reply	other threads:[~2020-05-07  1:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-05 19:00 Lenny Szubowicz
2020-05-06  7:23 ` Ard Biesheuvel
2020-05-07  1:49   ` Lenny Szubowicz [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2eb1c06-eb7c-8cfc-6cc8-9c66cf396813@redhat.com \
    --to=lszubowi@redhat.com \
    --cc=ardb@kernel.org \
    --cc=eric.snowberg@oracle.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nivedita@alum.mit.edu \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®