public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Jan Beulich <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: JBeulich@suse.com, hpa@zytor.com, tglx@linutronix.de,
	peterz@infradead.org, jbeulich@suse.com,
	ard.biesheuvel@linaro.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, matt@codeblueprint.co.uk,
	torvalds@linux-foundation.org
Subject: [tip:efi/core] efi/bgrt: Use efi_mem_type()
Date: Sat, 26 Aug 2017 00:59:40 -0700	[thread overview]
Message-ID: <tip-6de47a5e371f75f80544986e6c9636211a2ae8af@git.kernel.org> (raw)
In-Reply-To: <20170825155019.6740-6-ard.biesheuvel@linaro.org>

Commit-ID:  6de47a5e371f75f80544986e6c9636211a2ae8af
Gitweb:     http://git.kernel.org/tip/6de47a5e371f75f80544986e6c9636211a2ae8af
Author:     Jan Beulich <JBeulich@suse.com>
AuthorDate: Fri, 25 Aug 2017 16:50:19 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Sat, 26 Aug 2017 09:20:33 +0200

efi/bgrt: Use efi_mem_type()

Avoid effectively open-coding the function.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Jan Beulich <JBeulich@suse.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-efi@vger.kernel.org
Link: http://lkml.kernel.org/r/20170825155019.6740-6-ard.biesheuvel@linaro.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 drivers/firmware/efi/efi-bgrt.c | 22 +---------------------
 1 file changed, 1 insertion(+), 21 deletions(-)

diff --git a/drivers/firmware/efi/efi-bgrt.c b/drivers/firmware/efi/efi-bgrt.c
index b58233e..50793fd 100644
--- a/drivers/firmware/efi/efi-bgrt.c
+++ b/drivers/firmware/efi/efi-bgrt.c
@@ -27,26 +27,6 @@ struct bmp_header {
 	u32 size;
 } __packed;
 
-static bool efi_bgrt_addr_valid(u64 addr)
-{
-	efi_memory_desc_t *md;
-
-	for_each_efi_memory_desc(md) {
-		u64 size;
-		u64 end;
-
-		if (md->type != EFI_BOOT_SERVICES_DATA)
-			continue;
-
-		size = md->num_pages << EFI_PAGE_SHIFT;
-		end = md->phys_addr + size;
-		if (addr >= md->phys_addr && addr < end)
-			return true;
-	}
-
-	return false;
-}
-
 void __init efi_bgrt_init(struct acpi_table_header *table)
 {
 	void *image;
@@ -85,7 +65,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
 		goto out;
 	}
 
-	if (!efi_bgrt_addr_valid(bgrt->image_address)) {
+	if (efi_mem_type(bgrt->image_address) != EFI_BOOT_SERVICES_DATA) {
 		pr_notice("Ignoring BGRT: invalid image address\n");
 		goto out;
 	}

      reply	other threads:[~2017-08-26  8:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-25 15:50 [GIT PULL 0/5] more EFI changes for v4.14 Ard Biesheuvel
2017-08-25 15:50 ` [PATCH 1/5] efi/libstub: Enable reset attack mitigation Ard Biesheuvel
2017-08-26  7:58   ` [tip:efi/core] " tip-bot for Matthew Garrett
2017-08-25 15:50 ` [PATCH 2/5] efi/random: Increase size of firmware supplied randomness Ard Biesheuvel
2017-08-26  7:58   ` [tip:efi/core] " tip-bot for Ard Biesheuvel
2017-08-25 15:50 ` [PATCH 3/5] efi/reboot: Make function pointer orig_pm_power_off static Ard Biesheuvel
2017-08-26  7:58   ` [tip:efi/core] " tip-bot for Colin Ian King
2017-08-25 15:50 ` [PATCH 4/5] efi: move efi_mem_type() to common code Ard Biesheuvel
2017-08-26  7:59   ` [tip:efi/core] efi: Move " tip-bot for Jan Beulich
2017-08-25 15:50 ` [PATCH 5/5] efi: bgrt: use efi_mem_type() Ard Biesheuvel
2017-08-26  7:59   ` tip-bot for Jan Beulich [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=tip-6de47a5e371f75f80544986e6c9636211a2ae8af@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=JBeulich@suse.com \
    --cc=ard.biesheuvel@linaro.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=matt@codeblueprint.co.uk \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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