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.

powerpc/kexec/core: use big-endian types for crash variables

Use explicit word-sized big-endian types for kexec and crash related
variables. This makes the endianness unambiguous and avoids type
mismatches that trigger sparse warnings.

The change addresses sparse warnings like below (seen on both 32-bit
and 64-bit builds):

CHECK ../arch/powerpc/kexec/core.c
sparse: expected unsigned int static [addressable] [toplevel] [usertype] crashk_base
sparse: got restricted __be32 [usertype]
sparse: warning: incorrect type in assignment (different base types)
sparse: expected unsigned int static [addressable] [toplevel] [usertype] crashk_size
sparse: got restricted __be32 [usertype]
sparse: warning: incorrect type in assignment (different base types)
sparse: expected unsigned long long static [addressable] [toplevel] mem_limit
sparse: got restricted __be32 [usertype]
sparse: warning: incorrect type in assignment (different base types)
sparse: expected unsigned int static [addressable] [toplevel] [usertype] kernel_end
sparse: got restricted __be32 [usertype]

No functional change intended.

Fixes: ea961a828fe7 ("powerpc: Fix endian issues in kexec and crash dump code")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202512221405.VHPKPjnp-lkp@intel.com/
Signed-off-by: Sourabh Jain <sourabhjain@linux.ibm.com>
Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20251224151257.28672-1-sourabhjain@linux.ibm.com

authored by

Sourabh Jain and committed by
Madhavan Srinivasan
20197b96 6fc5d63c

+9 -8
+9 -8
arch/powerpc/kexec/core.c
··· 23 23 #include <asm/firmware.h> 24 24 25 25 #define cpu_to_be_ulong __PASTE(cpu_to_be, BITS_PER_LONG) 26 + #define __be_word __PASTE(__be, BITS_PER_LONG) 26 27 27 28 #ifdef CONFIG_CRASH_DUMP 28 29 void machine_crash_shutdown(struct pt_regs *regs) ··· 147 146 } 148 147 149 148 /* Values we need to export to the second kernel via the device tree. */ 150 - static phys_addr_t crashk_base; 151 - static phys_addr_t crashk_size; 152 - static unsigned long long mem_limit; 149 + static __be_word crashk_base; 150 + static __be_word crashk_size; 151 + static __be_word mem_limit; 153 152 154 153 static struct property crashk_base_prop = { 155 154 .name = "linux,crashkernel-base", 156 - .length = sizeof(phys_addr_t), 155 + .length = sizeof(__be_word), 157 156 .value = &crashk_base 158 157 }; 159 158 160 159 static struct property crashk_size_prop = { 161 160 .name = "linux,crashkernel-size", 162 - .length = sizeof(phys_addr_t), 161 + .length = sizeof(__be_word), 163 162 .value = &crashk_size, 164 163 }; 165 164 166 165 static struct property memory_limit_prop = { 167 166 .name = "linux,memory-limit", 168 - .length = sizeof(unsigned long long), 167 + .length = sizeof(__be_word), 169 168 .value = &mem_limit, 170 169 }; 171 170 ··· 194 193 } 195 194 #endif /* CONFIG_CRASH_RESERVE */ 196 195 197 - static phys_addr_t kernel_end; 196 + static __be_word kernel_end; 198 197 199 198 static struct property kernel_end_prop = { 200 199 .name = "linux,kernel-end", 201 - .length = sizeof(phys_addr_t), 200 + .length = sizeof(__be_word), 202 201 .value = &kernel_end, 203 202 }; 204 203