Re: [PATCH v2] s390/dis: Mark non-NUL-terminated character arrays with __nonstring

From: Jens Remus

Date: Mon Oct 05 2026 - 07:25:17 EST


On 10/5/2026 11:22 AM, Heiko Carstens wrote:
> With [1] the generated string initializers were changed to use an
> array instead of a non-NUL-terminated string. The reason was that GCC 15
> warns about string initializers that truncate the NUL terminator with
> -Wunterminated-string-initialization.
>
> The better solution is to use the __nonstring annotation, which exists
> to deal exactly with this problem. Therefore use it and basically
> revert [1] in order to generate more readable initializers:
>
> Before:
> [LONG_INSN_ALGHSIK] = { 'a', 'l', 'g', 'h', 's', 'i', 'k', },
>
> After:
> [LONG_INSN_ALGHSIK] = "alghsik",
>
> [1] commit 7cbae7ea3de5 ("s390/tools: Use array instead of string initializer")
>
> Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>

Reviewed-by: Jens Remus <jremus@xxxxxxxxxxxxx>

> ---
>
> Notes:
> Use __nonstring_array for long_insn_name array, since compilers before
> gcc 15 will otherwise warn with:
>
> arch/s390/kernel/dis.c:343:1: warning: 'nonstring' attribute ignored
> on objects of type 'char[][7]' [-Wattributes]
>
> arch/s390/kernel/dis.c | 4 ++--
> arch/s390/tools/gen_opcode_table.c | 23 ++++-------------------
> 2 files changed, 6 insertions(+), 21 deletions(-)

Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
jremus@xxxxxxxxxx / jremus@xxxxxxxxxxxxx

IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Ehningen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/