Skip to content

Commit 56e2ef8

Browse files
bjdooks-ctardbiesheuvel
authored andcommitted
efi: libstub: fix type of fdt 32 and 64bit variables
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> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 77dd8ad commit 56e2ef8

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

  • drivers/firmware/efi/libstub

drivers/firmware/efi/libstub/fdt.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
3232
{
3333
int node, num_rsv;
3434
int status;
35-
u32 fdt_val32;
36-
u64 fdt_val64;
35+
fdt32_t fdt_val32;
36+
fdt64_t fdt_val64;
3737

3838
/* Do some checks on provided FDT, if it exists: */
3939
if (orig_fdt) {
@@ -100,13 +100,13 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
100100
if (status)
101101
goto fdt_set_fail;
102102

103-
fdt_val64 = U64_MAX; /* placeholder */
103+
fdt_val64 = cpu_to_fdt64(U64_MAX); /* placeholder */
104104

105105
status = fdt_setprop_var(fdt, node, "linux,uefi-mmap-start", fdt_val64);
106106
if (status)
107107
goto fdt_set_fail;
108108

109-
fdt_val32 = U32_MAX; /* placeholder */
109+
fdt_val32 = cpu_to_fdt32(U32_MAX); /* placeholder */
110110

111111
status = fdt_setprop_var(fdt, node, "linux,uefi-mmap-size", fdt_val32);
112112
if (status)
@@ -147,8 +147,8 @@ static efi_status_t update_fdt(void *orig_fdt, unsigned long orig_fdt_size,
147147
static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map)
148148
{
149149
int node = fdt_path_offset(fdt, "/chosen");
150-
u64 fdt_val64;
151-
u32 fdt_val32;
150+
fdt64_t fdt_val64;
151+
fdt32_t fdt_val32;
152152
int err;
153153

154154
if (node < 0)

0 commit comments

Comments
 (0)