aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/efi
diff options
context:
space:
mode:
authorArd Biesheuvel <ard.biesheuvel@linaro.org>2015-10-23 05:48:16 -0400
committerIngo Molnar <mingo@kernel.org>2015-10-28 07:28:06 -0400
commit44511fb9e55ada760822b0b0d7be9d150576f17f (patch)
treed6f799bbdf19e659f7d582daac03af157300b486 /arch/x86/platform/efi
parent06ef431ab8060aa8ef51b36f56773d01f6a53f24 (diff)
efi: Use correct type for struct efi_memory_map::phys_map
We have been getting away with using a void* for the physical address of the UEFI memory map, since, even on 32-bit platforms with 64-bit physical addresses, no truncation takes place if the memory map has been allocated by the firmware (which only uses 1:1 virtually addressable memory), which is usually the case. However, commit: 0f96a99dab36 ("efi: Add "efi_fake_mem" boot option") adds code that clones and modifies the UEFI memory map, and the clone may live above 4 GB on 32-bit platforms. This means our use of void* for struct efi_memory_map::phys_map has graduated from 'incorrect but working' to 'incorrect and broken', and we need to fix it. So redefine struct efi_memory_map::phys_map as phys_addr_t, and get rid of a bunch of casts that are now unneeded. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: izumi.taku@jp.fujitsu.com Cc: kamezawa.hiroyu@jp.fujitsu.com Cc: linux-efi@vger.kernel.org Cc: matt.fleming@intel.com Link: http://lkml.kernel.org/r/1445593697-1342-1-git-send-email-ard.biesheuvel@linaro.org Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/platform/efi')
-rw-r--r--arch/x86/platform/efi/efi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 3e1d09e885c0..ad285404ea7f 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -194,7 +194,7 @@ static void __init do_add_efi_memmap(void)
194int __init efi_memblock_x86_reserve_range(void) 194int __init efi_memblock_x86_reserve_range(void)
195{ 195{
196 struct efi_info *e = &boot_params.efi_info; 196 struct efi_info *e = &boot_params.efi_info;
197 unsigned long pmap; 197 phys_addr_t pmap;
198 198
199 if (efi_enabled(EFI_PARAVIRT)) 199 if (efi_enabled(EFI_PARAVIRT))
200 return 0; 200 return 0;
@@ -209,7 +209,7 @@ int __init efi_memblock_x86_reserve_range(void)
209#else 209#else
210 pmap = (e->efi_memmap | ((__u64)e->efi_memmap_hi << 32)); 210 pmap = (e->efi_memmap | ((__u64)e->efi_memmap_hi << 32));
211#endif 211#endif
212 memmap.phys_map = (void *)pmap; 212 memmap.phys_map = pmap;
213 memmap.nr_map = e->efi_memmap_size / 213 memmap.nr_map = e->efi_memmap_size /
214 e->efi_memdesc_size; 214 e->efi_memdesc_size;
215 memmap.desc_size = e->efi_memdesc_size; 215 memmap.desc_size = e->efi_memdesc_size;