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
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
f3794366b0
commit
33de6b57a8
+1
-1
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user