public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] fs: proc: Fix build with GCC 15 due to -Werror=unterminated-string-initialization
@ 2024-10-02  8:05 Brahmajit Das
  2024-10-02  8:09 ` [PATCH v2 " Brahmajit Das
  0 siblings, 1 reply; 11+ messages in thread
From: Brahmajit Das @ 2024-10-02  8:05 UTC (permalink / raw)
  To: akpm, david, gorcunov; +Cc: linux-next

GCC 15 enables -Werror=unterminated-string-initialization by default.
This results in the following build error/s
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) + 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]
...

To fix this, the length of the second argument of arary mnemonics needs
to be 3 instead of previously set 2 (i.e. from [BITS_PER_LONG][2] to
[BITS_PER_LONG][3])

Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
---
 fs/proc/task_mmu.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c
index 72f14fd59c2d..aa5780696fc1 100644
--- a/fs/proc/task_mmu.c
+++ b/fs/proc/task_mmu.c
@@ -909,8 +909,15 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma)
 {
 	/*
 	 * Don't forget to update Documentation/ on changes.
+	 *
+	 * The length of the second argument of arary mnemonics
+	 * needs to be 3 instead of previously set 2
+	 * (i.e. from [BITS_PER_LONG][2] to [BITS_PER_LONG][3])
+	 * to avoid spurious
+	 * -Werror=unterminated-string-initialization warning
+	 *  with GCC 15
 	 */
-	static const char mnemonics[BITS_PER_LONG][2] = {
+	static const char mnemonics[BITS_PER_LONG][3] = {
 		/*
 		 * In case if we meet a flag we don't know about.
 		 */
-- 
2.46.2


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-10-28  8:02 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-02  8:05 [PATCH 1/1] fs: proc: Fix build with GCC 15 due to -Werror=unterminated-string-initialization Brahmajit Das
2024-10-02  8:09 ` [PATCH v2 " Brahmajit Das
2024-10-02 21:48   ` Andrew Morton
2024-10-02 23:30     ` Stephen Rothwell
2024-10-02 23:39     ` Stephen Rothwell
2024-10-04 20:16     ` Brahmajit
2024-10-04 21:12     ` Brahmajit
2024-10-04 21:58       ` Andrew Morton
2024-10-05  6:37         ` [PATCH v3 1/1] fs/proc: " Brahmajit Das
2024-10-08  2:08           ` Andrew Morton
2024-10-28  8:02             ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox