diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-05-29 17:12:39 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-31 16:10:46 +0200 |
commit | 33de6b57a82a70a5b1e6991d0eb459f5c49578f9 (patch) | |
tree | 8b251c905c686d3f3ba178fbc8c74bd49168a64b /src | |
parent | f3794366b07262ca213c63b61361e15647cfafda (diff) | |
download | systemd-33de6b57a82a70a5b1e6991d0eb459f5c49578f9.tar.gz |
efi: explicitly cast physical address to UINTN when converting to/from pointers
UINTN is the integer type equalling the native ptr size. Let's fix the
casting warnings described in #7788 by casting the the pointers and
values to this type first. That way we cast integers to the right size
first before turning them into pointers, and pointers are first
covnerted to integers of the right size before converting them into
integers.
Not tested, since I lack i386 EFI systems, but I think this is simple
enough to be correct event without testing.
Fixes: #7788
Diffstat (limited to 'src')
-rw-r--r-- | src/boot/efi/boot.c | 2 | ||||
-rw-r--r-- | src/boot/efi/linux.c | 2 | ||||
-rw-r--r-- | src/boot/efi/stub.c | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/boot/efi/boot.c b/src/boot/efi/boot.c index cc8fe6b641..72a946b1ad 100644 --- a/src/boot/efi/boot.c +++ b/src/boot/efi/boot.c @@ -1676,7 +1676,7 @@ static EFI_STATUS image_start(EFI_HANDLE parent_image, const Config *config, con #if ENABLE_TPM /* Try to log any options to the TPM, especially to catch manually edited options */ err = tpm_log_event(SD_TPM_PCR, - (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, + (EFI_PHYSICAL_ADDRESS) (UINTN) loaded_image->LoadOptions, loaded_image->LoadOptionsSize, loaded_image->LoadOptions); if (EFI_ERROR(err)) { Print(L"Unable to add image options measurement: %r", err); diff --git a/src/boot/efi/linux.c b/src/boot/efi/linux.c index e8f7651324..1f81f3e771 100644 --- a/src/boot/efi/linux.c +++ b/src/boot/efi/linux.c @@ -128,7 +128,7 @@ EFI_STATUS linux_exec(EFI_HANDLE *image, if (EFI_ERROR(err)) return err; CopyMem((VOID *)(UINTN)addr, cmdline, cmdline_len); - ((CHAR8 *)addr)[cmdline_len] = 0; + ((CHAR8 *)(UINTN)addr)[cmdline_len] = 0; boot_setup->cmd_line_ptr = (UINT32)addr; } diff --git a/src/boot/efi/stub.c b/src/boot/efi/stub.c index f368a67351..c107a07ee7 100644 --- a/src/boot/efi/stub.c +++ b/src/boot/efi/stub.c @@ -90,7 +90,7 @@ EFI_STATUS efi_main(EFI_HANDLE image, EFI_SYSTEM_TABLE *sys_table) { #if ENABLE_TPM /* Try to log any options to the TPM, especially manually edited options */ err = tpm_log_event(SD_TPM_PCR, - (EFI_PHYSICAL_ADDRESS) loaded_image->LoadOptions, + (EFI_PHYSICAL_ADDRESS) (UINTN) loaded_image->LoadOptions, loaded_image->LoadOptionsSize, loaded_image->LoadOptions); if (EFI_ERROR(err)) { Print(L"Unable to add image options measurement: %r", err); |