aboutsummaryrefslogtreecommitdiff
path: root/drivers/firmware/efi/libstub/x86-stub.c
diff options
context:
space:
mode:
authorArd Biesheuvel2020-02-14 14:29:21 +0100
committerArd Biesheuvel2020-02-23 21:59:42 +0100
commitf7b85b33eb0b3025830a102b01e6e1c3426cdf13 (patch)
tree11421638fef0184982fa81b41daed0a1385433e0 /drivers/firmware/efi/libstub/x86-stub.c
parent832187f03994b03b6cc4a3b9130d82b1ec5cbec4 (diff)
efi/libstub/x86: Make loaded_image protocol handling mixed mode safe
Add the definitions and use the special wrapper so that the loaded_image UEFI protocol can be safely used from mixed mode. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/x86-stub.c')
-rw-r--r--drivers/firmware/efi/libstub/x86-stub.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/x86-stub.c b/drivers/firmware/efi/libstub/x86-stub.c
index 7d4866471f86..ce0c3caa3087 100644
--- a/drivers/firmware/efi/libstub/x86-stub.c
+++ b/drivers/firmware/efi/libstub/x86-stub.c
@@ -377,7 +377,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
return status;
}
- hdr = &((struct boot_params *)image->image_base)->hdr;
+ hdr = &((struct boot_params *)efi_table_attr(image, image_base))->hdr;
above4g = hdr->xloadflags & XLF_CAN_BE_LOADED_ABOVE_4G;
status = efi_allocate_pages(0x4000, (unsigned long *)&boot_params,
@@ -392,7 +392,7 @@ efi_status_t __efiapi efi_pe_entry(efi_handle_t handle,
hdr = &boot_params->hdr;
/* Copy the second sector to boot_params */
- memcpy(&hdr->jump, image->image_base + 512, 512);
+ memcpy(&hdr->jump, efi_table_attr(image, image_base) + 512, 512);
/*
* Fill out some of the header fields ourselves because the