Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Ben Dooks and committed by
Ard Biesheuvel
56e2ef8f 77dd8ada

+6 -6
+6 -6
drivers/firmware/efi/libstub/fdt.c
··· 32 32 { 33 33 int node, num_rsv; 34 34 int status; 35 - u32 fdt_val32; 36 - u64 fdt_val64; 35 + fdt32_t fdt_val32; 36 + fdt64_t fdt_val64; 37 37 38 38 /* Do some checks on provided FDT, if it exists: */ 39 39 if (orig_fdt) { ··· 100 100 if (status) 101 101 goto fdt_set_fail; 102 102 103 - fdt_val64 = U64_MAX; /* placeholder */ 103 + fdt_val64 = cpu_to_fdt64(U64_MAX); /* placeholder */ 104 104 105 105 status = fdt_setprop_var(fdt, node, "linux,uefi-mmap-start", fdt_val64); 106 106 if (status) 107 107 goto fdt_set_fail; 108 108 109 - fdt_val32 = U32_MAX; /* placeholder */ 109 + fdt_val32 = cpu_to_fdt32(U32_MAX); /* placeholder */ 110 110 111 111 status = fdt_setprop_var(fdt, node, "linux,uefi-mmap-size", fdt_val32); 112 112 if (status) ··· 147 147 static efi_status_t update_fdt_memmap(void *fdt, struct efi_boot_memmap *map) 148 148 { 149 149 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; 152 152 int err; 153 153 154 154 if (node < 0)