* [PATCH] efi: libstub: fix type of fdt 32 and 64bit variables
@ 2026-03-09 17:10 Ben Dooks
2026-03-10 14:38 ` Ard Biesheuvel
0 siblings, 1 reply; 2+ messages in thread
From: Ben Dooks @ 2026-03-09 17:10 UTC (permalink / raw)
To: ardb, linux-efi; +Cc: ilias.apalodimas, linux-kernel, Ben Dooks
In update_fdt_memmap() an update_fdt() the fdt values should be
of the fd32_t and fdt64_t types. Make the relevant changes to
remove the following sparse warnings:
drivers/firmware/efi/libstub/fdt.c:97:19: warning: incorrect type in assignment (different base types)
drivers/firmware/efi/libstub/fdt.c:97:19: expected unsigned long long [usertype] fdt_val64
drivers/firmware/efi/libstub/fdt.c:97:19: got restricted __be64 [usertype]
drivers/firmware/efi/libstub/fdt.c:157:19: warning: incorrect type in assignment (different base types)
drivers/firmware/efi/libstub/fdt.c:157:19: expected unsigned long long [usertype] fdt_val64
drivers/firmware/efi/libstub/fdt.c:157:19: got restricted __be64 [usertype]
drivers/firmware/efi/libstub/fdt.c:163:19: warning: incorrect type in assignment (different base types)
drivers/firmware/efi/libstub/fdt.c:163:19: expected unsigned int [usertype] fdt_val32
drivers/firmware/efi/libstub/fdt.c:163:19: got restricted __be32 [usertype]
drivers/firmware/efi/libstub/fdt.c:169:19: warning: incorrect type in assignment (different base types)
drivers/firmware/efi/libstub/fdt.c:169:19: expected unsigned int [addressable] [usertype] fdt_val32
drivers/firmware/efi/libstub/fdt.c:169:19: got restricted __be32 [usertype]
drivers/firmware/efi/libstub/fdt.c:175:19: warning: incorrect type in assignment (different base types)
drivers/firmware/efi/libstub/fdt.c:175:19: expected unsigned int [addressable] [usertype] fdt_val32
drivers/firmware/efi/libstub/fdt.c:175:19: got restricted __be32 [usertype]
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
drivers/firmware/efi/libstub/fdt.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c
index 6a337f1f8787..23b3543d3041 100644
--- a/drivers/firmware/efi/libstub/fdt.c
+++ b/drivers/firmware/efi/libstub/fdt.c
@@ -32,8 +32,8 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
{
int node, num_rsv;
int status;
- u32 fdt_val32;
- u64 fdt_val64;
+ fdt32_t fdt_val32;
+ fdt64_t fdt_val64;
/* Do some checks on provided FDT, if it exists: */
if (orig_fdt) {
@@ -100,13 +100,13 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
if (status)
goto fdt_set_fail;
- fdt_val64 = U64_MAX; /* placeholder */
+ fdt_val64 = cpu_to_fdt64(U64_MAX); /* placeholder */
status = fdt_setprop_var(fdt, node, "linux,uefi-mmap-start", fdt_val64);
if (status)
goto fdt_set_fail;
- fdt_val32 = U32_MAX; /* placeholder */
+ fdt_val32 = cpu_to_fdt32(U32_MAX); /* placeholder */
status = fdt_setprop_var(fdt, node, "linux,uefi-mmap-size", fdt_val32);
if (status)
@@ -147,8 +147,8 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map)
{
int node = fdt_path_offset(fdt, "/chosen");
- u64 fdt_val64;
- u32 fdt_val32;
+ fdt64_t fdt_val64;
+ fdt32_t fdt_val32;
int err;
if (node < 0)
--
2.37.2.352.g3c44437643
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] efi: libstub: fix type of fdt 32 and 64bit variables
2026-03-09 17:10 [PATCH] efi: libstub: fix type of fdt 32 and 64bit variables Ben Dooks
@ 2026-03-10 14:38 ` Ard Biesheuvel
0 siblings, 0 replies; 2+ messages in thread
From: Ard Biesheuvel @ 2026-03-10 14:38 UTC (permalink / raw)
To: Ben Dooks, linux-efi; +Cc: Ilias Apalodimas, linux-kernel
On Mon, 9 Mar 2026, at 18:10, Ben Dooks wrote:
> In update_fdt_memmap() an update_fdt() the fdt values should be
> of the fd32_t and fdt64_t types. Make the relevant changes to
> remove the following sparse warnings:
>
> drivers/firmware/efi/libstub/fdt.c:97:19: warning: incorrect type in
> assignment (different base types)
> drivers/firmware/efi/libstub/fdt.c:97:19: expected unsigned long
> long [usertype] fdt_val64
> drivers/firmware/efi/libstub/fdt.c:97:19: got restricted __be64
> [usertype]
> drivers/firmware/efi/libstub/fdt.c:157:19: warning: incorrect type in
> assignment (different base types)
> drivers/firmware/efi/libstub/fdt.c:157:19: expected unsigned long
> long [usertype] fdt_val64
> drivers/firmware/efi/libstub/fdt.c:157:19: got restricted __be64
> [usertype]
> drivers/firmware/efi/libstub/fdt.c:163:19: warning: incorrect type in
> assignment (different base types)
> drivers/firmware/efi/libstub/fdt.c:163:19: expected unsigned int
> [usertype] fdt_val32
> drivers/firmware/efi/libstub/fdt.c:163:19: got restricted __be32
> [usertype]
> drivers/firmware/efi/libstub/fdt.c:169:19: warning: incorrect type in
> assignment (different base types)
> drivers/firmware/efi/libstub/fdt.c:169:19: expected unsigned int
> [addressable] [usertype] fdt_val32
> drivers/firmware/efi/libstub/fdt.c:169:19: got restricted __be32
> [usertype]
> drivers/firmware/efi/libstub/fdt.c:175:19: warning: incorrect type in
> assignment (different base types)
> drivers/firmware/efi/libstub/fdt.c:175:19: expected unsigned int
> [addressable] [usertype] fdt_val32
> drivers/firmware/efi/libstub/fdt.c:175:19: got restricted __be32
> [usertype]
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> drivers/firmware/efi/libstub/fdt.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
Queued up in efi/next - thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-10 14:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-09 17:10 [PATCH] efi: libstub: fix type of fdt 32 and 64bit variables Ben Dooks
2026-03-10 14:38 ` Ard Biesheuvel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox