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.

parisc: Inline a type punning version of get_unaligned_le32()

Reading the byte/char output_len with get_unaligned_le32() can trigger
compiler warnings due to the size read. Avoid these warnings by using
type punning. This avoids issues when switching get_unaligned_t() to
__builtin_memcpy().

Signed-off-by: Ian Rogers <irogers@google.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20251016205126.2882625-2-irogers@google.com

authored by

Ian Rogers and committed by
Thomas Gleixner
df0f9a66 7158fc54

+14 -1
+14 -1
arch/parisc/boot/compressed/misc.c
··· 278 278 free(phdrs); 279 279 } 280 280 281 + /* 282 + * The regular get_unaligned_le32 uses __builtin_memcpy which can trigger 283 + * warnings when reading a byte/char output_len as an integer, as the size of a 284 + * char is less than that of an integer. Use type punning and the packed 285 + * attribute, which requires -fno-strict-aliasing, to work around the problem. 286 + */ 287 + static u32 punned_get_unaligned_le32(const void *p) 288 + { 289 + const struct { __le32 x; } __packed * __get_pptr = p; 290 + 291 + return le32_to_cpu(__get_pptr->x); 292 + } 293 + 281 294 asmlinkage unsigned long __visible decompress_kernel(unsigned int started_wide, 282 295 unsigned int command_line, 283 296 const unsigned int rd_start, ··· 322 309 * leave 2 MB for the stack. 323 310 */ 324 311 vmlinux_addr = (unsigned long) &_ebss + 2*1024*1024; 325 - vmlinux_len = get_unaligned_le32(&output_len); 312 + vmlinux_len = punned_get_unaligned_le32(&output_len); 326 313 output = (char *) vmlinux_addr; 327 314 328 315 /*