linux/fs/proc
Brahmajit Das 5778ace04e fs/proc: fix build with GCC 15 due to -Werror=unterminated-string-initialization
show show_smap_vma_flags() has been a using misspelled initializer in
mnemonics[] - it needed to initialize 2 element array of char and it used
NUL-padded 2 character string literals (i.e.  3-element initializer).

This has been spotted by gcc-15[*]; prior to that gcc quietly dropped the
3rd eleemnt of initializers.  To fix this we are increasing the size of
mnemonics[] (from mnemonics[BITS_PER_LONG][2] to
mnemonics[BITS_PER_LONG][3]) to accomodate the NUL-padded string literals.

This also helps us in simplyfying the logic for printing of the flags as
instead of printing each character from the mnemonics[], we can just print
the mnemonics[] using seq_printf.

[*]: fs/proc/task_mmu.c:917:49: error: initializer-string for array of `char' is too long [-Werror=unterminate d-string-initialization]
  917 |                 [0 ... (BITS_PER_LONG-1)] = "??",
      |                                                 ^~~~
fs/proc/task_mmu.c:917:49: error: initializer-string for array of `char' is too long [-Werror=unterminate d-string-initialization]
fs/proc/task_mmu.c:917:49: error: initializer-string for array of `char' is too long [-Werror=unterminate d-string-initialization]
fs/proc/task_mmu.c:917:49: error: initializer-string for array of `char' is too long [-Werror=unterminate d-string-initialization]
fs/proc/task_mmu.c:917:49: error: initializer-string for array of `char' is too long [-Werror=unterminate d-string-initialization]
fs/proc/task_mmu.c:917:49: error: initializer-string for array of `char' is too long [-Werror=unterminate d-string-initialization]
...


Stephen pointed out:

: The C standard explicitly allows for a string initializer to be too long
: due to the NUL byte at the end ...  so this warning may be overzealous.

but let's make the warning go away anwyay.

Link: https://lkml.kernel.org/r/20241005063700.2241027-1-brahmajit.xyz@gmail.com
Link: https://lkml.kernel.org/r/20241003093040.47c08382@canb.auug.org.au
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-10-17 00:28:07 -07:00
..
array.c fs/proc: do_task_stat: use sig->stats_lock to gather the threads/children stats 2024-02-07 21:20:33 -08:00
base.c In the v6.12 scheduler development cycle we had 63 commits from 18 contributors: 2024-09-19 15:55:58 +02:00
bootconfig.c fs/proc: Skip bootloader comment if no embedded kernel parameters 2024-04-09 23:36:18 +09:00
cmdline.c proc: mark /proc/cmdline as permanent 2023-02-02 22:50:02 -08:00
consoles.c proc: Add nbcon support for /proc/consoles 2024-09-04 15:56:33 +02:00
cpuinfo.c
devices.c proc: mark more files as permanent 2022-10-03 14:21:45 -07:00
fd.c vfs-6.12.procfs 2024-09-16 09:36:59 +02:00
fd.h fs: port ->permission() to pass mnt_idmap 2023-01-19 09:24:28 +01:00
generic.c proc: fold kmalloc() + strcpy() into kmemdup() 2024-09-09 10:51:20 +02:00
inode.c proc: use __auto_type more 2024-09-17 01:11:20 -07:00
internal.h ALong with the usual shower of singleton patches, notable patch series in 2024-09-21 07:29:05 -07:00
interrupts.c
Kconfig crash: split vmcoreinfo exporting code out from crash_core.c 2024-02-23 17:48:22 -08:00
kcore.c fs/proc/kcore.c: allow translation of physical memory addresses 2024-10-09 12:47:19 -07:00
kmsg.c printk changes for 6.1 2022-10-10 11:24:19 -07:00
loadavg.c proc: mark more files as permanent 2022-10-03 14:21:45 -07:00
Makefile kbuild: make -Woverride-init warnings more consistent 2024-03-31 11:32:26 +09:00
meminfo.c mm: zswap: optimize zswap pool size tracking 2024-04-25 20:55:47 -07:00
namespaces.c
nommu.c fs: create helper file_user_path() for user displayed mapped file path 2023-10-19 11:03:15 +02:00
page.c x86: remove PG_uncached 2024-09-03 21:15:46 -07:00
proc_net.c fs: Add kernel-doc comments to proc_create_net_data_write() 2024-03-26 09:01:18 +01:00
proc_sysctl.c sysctl: avoid spurious permanent empty tables 2024-09-02 10:37:37 +02:00
proc_tty.c
root.c procfs: make freeing proc_fs_info rcu-delayed 2024-02-25 02:10:32 -05:00
self.c proc: convert to new timestamp accessors 2023-10-18 14:08:26 +02:00
softirqs.c proc: mark more files as permanent 2022-10-03 14:21:45 -07:00
stat.c proc/stat: remove arch_idle_time() 2023-04-18 16:39:33 -07:00
task_mmu.c fs/proc: fix build with GCC 15 due to -Werror=unterminated-string-initialization 2024-10-17 00:28:07 -07:00
task_nommu.c vfs-6.7.misc 2023-10-30 09:14:19 -10:00
thread_self.c proc: convert to new timestamp accessors 2023-10-18 14:08:26 +02:00
uptime.c proc: mark more files as permanent 2022-10-03 14:21:45 -07:00
util.c
version.c proc: mark more files as permanent 2022-10-03 14:21:45 -07:00
vmcore.c fs/proc: fix softlockup in __read_vmcore 2024-05-11 15:51:44 -07:00