Skip to content

Commit e14cfb3

Browse files
arndbIngo Molnar
authored andcommitted
x86/boot/compressed: Avoid gcc-11 -Wstringop-overread warning
GCC gets confused by the comparison of a pointer to an integer literal, with the assumption that this is an offset from a NULL pointer and that dereferencing it is invalid: In file included from arch/x86/boot/compressed/misc.c:18: In function ‘parse_elf’, inlined from ‘extract_kernel’ at arch/x86/boot/compressed/misc.c:442:2: arch/x86/boot/compressed/../string.h:15:23: error: ‘__builtin_memcpy’ reading 64 bytes from a region of size 0 [-Werror=stringop-overread] 15 | #define memcpy(d,s,l) __builtin_memcpy(d,s,l) | ^~~~~~~~~~~~~~~~~~~~~~~ arch/x86/boot/compressed/misc.c:283:9: note: in expansion of macro ‘memcpy’ 283 | memcpy(&ehdr, output, sizeof(ehdr)); | ^~~~~~ I could not find any good workaround for this, but as this is only a warning for a failure during early boot, removing the line entirely works around the warning. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Martin Sebor <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent cdc34cb commit e14cfb3

File tree

1 file changed

+0
-2
lines changed
  • arch/x86/boot/compressed

1 file changed

+0
-2
lines changed

arch/x86/boot/compressed/misc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,6 @@ asmlinkage __visible void *extract_kernel(void *rmode, memptr heap,
430430
error("Destination address too large");
431431
#endif
432432
#ifndef CONFIG_RELOCATABLE
433-
if ((unsigned long)output != LOAD_PHYSICAL_ADDR)
434-
error("Destination address does not match LOAD_PHYSICAL_ADDR");
435433
if (virt_addr != LOAD_PHYSICAL_ADDR)
436434
error("Destination virtual address changed when not relocatable");
437435
#endif

0 commit comments

Comments
 (0)