Skip to content

Commit

Permalink
kernel-stub: Avoid warnings when converting buffer addresses to pointers
Browse files Browse the repository at this point in the history
On 32-bit systems, we get "cast to pointer from integer of different
size" warnings. Silence then which we can safely do because the
fdt_buffer will not exceed 32 bits, being provided by AllocatePages().

Signed-off-by: Jan Kiszka <[email protected]>
  • Loading branch information
jan-kiszka committed Aug 10, 2023
1 parent 4b76201 commit be4d826
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions kernel-stub/fdt.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ static EFI_STATUS clone_fdt(const VOID *fdt, UINTN size,
error(L"Error allocating device tree buffer", status);
return status;
}
CopyMem((VOID *)*fdt_buffer, fdt, BE32_TO_HOST(header->TotalSize));
CopyMem((VOID *)(uintptr_t)*fdt_buffer, fdt,
BE32_TO_HOST(header->TotalSize));
return EFI_SUCCESS;
}

Expand Down Expand Up @@ -203,7 +204,8 @@ EFI_STATUS replace_fdt(const VOID *fdt)
return status;
}

status = protocol->Fixup(protocol, (VOID *)fdt_buffer, &size,
status = protocol->Fixup(protocol,
(VOID *)(uintptr_t)fdt_buffer, &size,
EFI_DT_APPLY_FIXUPS |
EFI_DT_RESERVE_MEMORY);
if (EFI_ERROR(status)) {
Expand All @@ -214,7 +216,7 @@ EFI_STATUS replace_fdt(const VOID *fdt)
}

status = BS->InstallConfigurationTable(&EfiDtbTableGuid,
(VOID *)fdt_buffer);
(VOID *)(uintptr_t)fdt_buffer);
if (EFI_ERROR(status)) {
(VOID) BS->FreePages(fdt_buffer, SIZE_IN_PAGES(size));
error(L"Failed to install alternative device tree", status);
Expand Down

0 comments on commit be4d826

Please sign in to comment.