lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241002214656.GG4017910@ZenIV>
Date: Wed, 2 Oct 2024 22:46:56 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Brahmajit <brahmajit.xyz@...il.com>
Cc: chaosman@...ika.net, linux-kernel <linux-kernel@...r.kernel.org>,
	Christian Brauner <brauner@...nel.org>
Subject: Re: Build failure with GCC 15 due to
 -Werror=unterminated-string-initialization

On Thu, Oct 03, 2024 at 02:46:48AM +0530, Brahmajit wrote:
> I'm building the latest kernel with GCC 15 and got this build failure
> 
> fs/qnx6/inode.c: In function ‘qnx6_checkroot’:
> fs/qnx6/inode.c:182:41: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
>   182 |         static char match_root[2][3] = {".\0\0", "..\0"};
>       |                                         ^~~~~~~
> fs/qnx6/inode.c:182:50: error: initializer-string for array of ‘char’ is too long [-Werror=unterminated-string-initialization]
>   182 |         static char match_root[2][3] = {".\0\0", "..\0"};
>       |                                                  ^~~~~~
> 	
> This is due to GCC 15 now enables
> -Werror=unterminated-string-initialization by default.
> This is not the only error, there are many such build failures in
> various subsystems, some of theme are easy to fix, while some are not.
> In this case I was thinking of something like:
> 
> --- a/fs/qnx6/inode.c
> +++ b/fs/qnx6/inode.c
> @@ -179,7 +179,7 @@ static int qnx6_statfs(struct dentry *dentry, struct kstatfs *buf)
>   */
>  static const char *qnx6_checkroot(struct super_block *s)
>  {
> -	static char match_root[2][3] = {".\0\0", "..\0"};
> +	static char *match_root[][3] = {".\0\0", "..\0"};

Huh?  That makes no sense whatsoever - you get a single-element
array of 3-element arrays of pointers to char.

What you have written is equivalent to
	static char *s1 = ".\0\0";
	static char *s2 = "..\0";
	static char *match_root[1][3] = {[0][0] = s1, [0][1] = s2, [0][2] = NULL};

and match_root[0] is *NOT* a pointer to char anymore.

Just lose the last \0 in each of those string literals...

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ