aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Bradford <robert.bradford@intel.com>2019-05-25 07:25:59 -0400
committerIngo Molnar <mingo@kernel.org>2019-05-25 07:48:17 -0400
commit88447c5b93d98be847f428c39ba589779a59eb83 (patch)
treecee45ba436e2cd3dda721a76d23a2e8c8ef4ecf7
parent4e78921ba4dd0aca1cc89168f45039add4183f8e (diff)
efi: Allow the number of EFI configuration tables entries to be zero
Only try and access the EFI configuration tables if there there are any reported. This allows EFI to be continued to used on systems where there are no configuration table entries. Signed-off-by: Rob Bradford <robert.bradford@intel.com> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Gen Zhang <blackgod016574@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: linux-efi@vger.kernel.org Link: http://lkml.kernel.org/r/20190525112559.7917-3-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
-rw-r--r--arch/x86/platform/efi/quirks.c3
-rw-r--r--drivers/firmware/efi/efi.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/arch/x86/platform/efi/quirks.c b/arch/x86/platform/efi/quirks.c
index feb77777c8b8..632b83885867 100644
--- a/arch/x86/platform/efi/quirks.c
+++ b/arch/x86/platform/efi/quirks.c
@@ -513,6 +513,9 @@ int __init efi_reuse_config(u64 tables, int nr_tables)
513 void *p, *tablep; 513 void *p, *tablep;
514 struct efi_setup_data *data; 514 struct efi_setup_data *data;
515 515
516 if (nr_tables == 0)
517 return 0;
518
516 if (!efi_setup) 519 if (!efi_setup)
517 return 0; 520 return 0;
518 521
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 55b77c576c42..521a541d02ad 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -636,6 +636,9 @@ int __init efi_config_init(efi_config_table_type_t *arch_tables)
636 void *config_tables; 636 void *config_tables;
637 int sz, ret; 637 int sz, ret;
638 638
639 if (efi.systab->nr_tables == 0)
640 return 0;
641
639 if (efi_enabled(EFI_64BIT)) 642 if (efi_enabled(EFI_64BIT))
640 sz = sizeof(efi_config_table_64_t); 643 sz = sizeof(efi_config_table_64_t);
641 else 644 else