From: Linn Crosetto <linn@hpe.com>
To: Eugene Korenevsky <ekorenevsky@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
Matt Fleming <matt@codeblueprint.co.uk>
Subject: Re: [PATCH] EFI loader: remove dead code
Date: Tue, 1 Nov 2016 16:09:50 -0700 [thread overview]
Message-ID: <20161101230950.GD3567@oranje.usa.hp.com> (raw)
In-Reply-To: <20161101173808.GA2682@vnote>
On Tue, Nov 01, 2016 at 08:38:08PM +0300, Eugene Korenevsky wrote:
> *e820ext is always NULL in 'alloc_e820ext()' (see the code of 'exit_boot()').
> Therefore the 'if' condition is always false and the entire 'if' statement is
> pointless. Remove it.
>
> ---
> arch/x86/boot/compressed/eboot.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
> index cc69e37..edfd4d6 100644
> --- a/arch/x86/boot/compressed/eboot.c
> +++ b/arch/x86/boot/compressed/eboot.c
> @@ -956,12 +956,6 @@ static efi_status_t alloc_e820ext(u32 nr_desc, struct setup_data **e820ext,
> size = sizeof(struct setup_data) +
> sizeof(struct e820entry) * nr_desc;
>
> - if (*e820ext) {
> - efi_call_early(free_pool, *e820ext);
> - *e820ext = NULL;
> - *e820ext_size = 0;
> - }
> -
I agree with your reading of the code. On the other hand, alloc_e820ext()
has no knowledge of the 'first' flag used in exit_boot_func() so the call to
free provides some assurance that memory isn't leaked if the calling code is
changed.
If the caller is responsible for freeing the memory in such a case, then
alloc_e820ext() should at least return an error.
--
Linn
next prev parent reply other threads:[~2016-11-01 23:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-01 17:38 [PATCH] EFI loader: remove dead code Eugene Korenevsky
2016-11-01 17:38 ` Eugene Korenevsky
2016-11-01 23:09 ` Linn Crosetto [this message]
[not found] ` <20161101230950.GD3567-Yas9JMe0lDZoF4rmPqRKaQC/G2K4zDHf@public.gmane.org>
2016-11-02 5:55 ` Eugene Korenevsky
2016-11-02 5:55 ` Eugene Korenevsky
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=20161101230950.GD3567@oranje.usa.hp.com \
--to=linn@hpe.com \
--cc=ekorenevsky@gmail.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt@codeblueprint.co.uk \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.