From 33c75584cdbca097e6890a0568b0eeaf626fb0d2 Mon Sep 17 00:00:00 2001 From: Marc Hartmayer Date: Mon, 6 Jul 2026 11:10:28 +0200 Subject: [PATCH] zipl: Fix -Wstringop-overread warning in IMPORT_DATA macro MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Declare binary data symbols as arrays to correctly represent linker-provided symbols of unknown size. This resolves compiler warnings about reading 22-24 bytes from a 1-byte region when including stage* loaders. DEBUG: In function ‘memcpy’, DEBUG: inlined from ‘boot_init_eckd_ldl_stage0’ at boot.c:181:2, DEBUG: inlined from ‘install_svdump_eckd_ldl’ at install.c:891:2, DEBUG: inlined from ‘install_dump’ at install.c:1221:9, DEBUG: inlined from ‘main’ at zipl.c:185:9: DEBUG: /usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 22 bytes from a region of size 1 [-Wstringop-overread] DEBUG: 29 | return __builtin___memcpy_chk (__dest, __src, __len, DEBUG: | ^ Signed-off-by: Marc Hartmayer Reviewed-by: Steffen Eiden Signed-off-by: Jan Höppner --- zipl/src/boot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/zipl/src/boot.c b/zipl/src/boot.c index 01879d48..2794e166 100644 --- a/zipl/src/boot.c +++ b/zipl/src/boot.c @@ -30,12 +30,12 @@ /* Import a binary file */ /* clang-format off */ #define DATA_NAME(SYM, SUFFIX) _binary_##SYM##_bin##SUFFIX -#define DATA_SIZE(SYM) ((size_t)(&DATA_NAME(SYM, _end) - &DATA_NAME(SYM, _start))) +#define DATA_SIZE(SYM) ((size_t)(DATA_NAME(SYM, _end) - DATA_NAME(SYM, _start))) #define DATA_ADDR(SYM) (&DATA_NAME(SYM, _start)) #define BIN_FILE_PATH(FILE_NAME) STRINGIFY(BUILD_PATH) "/" STRINGIFY(FILE_NAME) ".bin" #define IMPORT_DATA(SYM) \ - extern const uint8_t DATA_NAME(SYM, _start); \ - extern const uint8_t DATA_NAME(SYM, _end); \ + extern const uint8_t DATA_NAME(SYM, _start)[]; \ + extern const uint8_t DATA_NAME(SYM, _end)[]; \ asm(".section \".rodata\", \"a\", @progbits\n" \ ".balign 4\n" \ ".global " STRINGIFY(DATA_NAME(SYM, _start)) "\n" \