public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Eugene Korenevsky <ekorenevsky@gmail.com>
To: linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org
Cc: Matt Fleming <matt@codeblueprint.co.uk>,
	Linn Crosetto <linn@hpe.com>,
	Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>
Subject: [PATCH v2] EFI loader: remove redundant code
Date: Wed, 2 Nov 2016 07:18:55 +0300	[thread overview]
Message-ID: <20161102041855.GA4479@vnote> (raw)

*e820ext is always NULL in 'alloc_e820ext()' (see the code of 'exit_boot()').
Without loss of generality we can replace freeing with returning
EFI_INVALID_PARAMETER. So if the caller would ever incorrectly pass non-NULL
*e820ext, he will obtain a returned error code.

---
 arch/x86/boot/compressed/eboot.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index cc69e37..6cc66c7 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -956,11 +956,8 @@ 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;
-	}
+	if (*e820ext)
+		return EFI_INVALID_PARAMETER;
 
 	status = efi_call_early(allocate_pool, EFI_LOADER_DATA,
 				size, (void **)e820ext);
-- 
2.10.2

             reply	other threads:[~2016-11-02  4:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02  4:18 Eugene Korenevsky [this message]
2016-11-02  9:25 ` [PATCH v2] EFI loader: remove redundant code Ard Biesheuvel
2016-11-02 13:56   ` Eugene Korenevsky
2016-11-02 13:57     ` Ard Biesheuvel

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=20161102041855.GA4479@vnote \
    --to=ekorenevsky@gmail.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linn@hpe.com \
    --cc=linux-efi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@redhat.com \
    --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