Commit 6de47a5e authored by Jan Beulich's avatar Jan Beulich Committed by Ingo Molnar

efi/bgrt: Use efi_mem_type()

Avoid effectively open-coding the function.
Signed-off-by: default avatarJan Beulich <jbeulich@suse.com>
Signed-off-by: default avatarArd 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.orgSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 23f0571c
...@@ -27,26 +27,6 @@ struct bmp_header { ...@@ -27,26 +27,6 @@ struct bmp_header {
u32 size; u32 size;
} __packed; } __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 __init efi_bgrt_init(struct acpi_table_header *table)
{ {
void *image; void *image;
...@@ -85,7 +65,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table) ...@@ -85,7 +65,7 @@ void __init efi_bgrt_init(struct acpi_table_header *table)
goto out; 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"); pr_notice("Ignoring BGRT: invalid image address\n");
goto out; goto out;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment