diff options
author | Ard Biesheuvel <ard.biesheuvel@linaro.org> | 2015-10-23 05:48:16 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-10-28 07:28:06 -0400 |
commit | 44511fb9e55ada760822b0b0d7be9d150576f17f (patch) | |
tree | d6f799bbdf19e659f7d582daac03af157300b486 /drivers/firmware/efi | |
parent | 06ef431ab8060aa8ef51b36f56773d01f6a53f24 (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 'drivers/firmware/efi')
-rw-r--r-- | drivers/firmware/efi/efi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c index 31fc864eb037..027ca212179f 100644 --- a/drivers/firmware/efi/efi.c +++ b/drivers/firmware/efi/efi.c | |||
@@ -254,7 +254,7 @@ subsys_initcall(efisubsys_init); | |||
254 | int __init efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) | 254 | int __init efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) |
255 | { | 255 | { |
256 | struct efi_memory_map *map = efi.memmap; | 256 | struct efi_memory_map *map = efi.memmap; |
257 | void *p, *e; | 257 | phys_addr_t p, e; |
258 | 258 | ||
259 | if (!efi_enabled(EFI_MEMMAP)) { | 259 | if (!efi_enabled(EFI_MEMMAP)) { |
260 | pr_err_once("EFI_MEMMAP is not enabled.\n"); | 260 | pr_err_once("EFI_MEMMAP is not enabled.\n"); |
@@ -286,10 +286,10 @@ int __init efi_mem_desc_lookup(u64 phys_addr, efi_memory_desc_t *out_md) | |||
286 | * So just always get our own virtual map on the CPU. | 286 | * So just always get our own virtual map on the CPU. |
287 | * | 287 | * |
288 | */ | 288 | */ |
289 | md = early_memremap((phys_addr_t)p, sizeof (*md)); | 289 | md = early_memremap(p, sizeof (*md)); |
290 | if (!md) { | 290 | if (!md) { |
291 | pr_err_once("early_memremap(%p, %zu) failed.\n", | 291 | pr_err_once("early_memremap(%pa, %zu) failed.\n", |
292 | p, sizeof (*md)); | 292 | &p, sizeof (*md)); |
293 | return -ENOMEM; | 293 | return -ENOMEM; |
294 | } | 294 | } |
295 | 295 | ||