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: <20241004184440.GQ4017910@ZenIV>
Date: Fri, 4 Oct 2024 19:44:40 +0100
From: Al Viro <viro@...iv.linux.org.uk>
To: Brahmajit Das <brahmajit.xyz@...il.com>
Cc: brauner@...nel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] fs/qnx6: Fix building with GCC 15

On Fri, Oct 04, 2024 at 03:19:21PM +0530, Brahmajit Das wrote:
> GCC 15 enables -Werror=unterminated-string-initialization by default.
> This results in the following build error
> 
> 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"};
>       |                                                  ^~~~~~
> 
> Dropping to match_root array and drictly comparing dir_entry entries via
> memcmp provides a work aroud for the build error.

LGTM, except that I'd probably make the commit message less warning-centric -
something like

	qnx6_checkroot() had been using weirdly spelled initializer - it needed
	to initialize 3-element arrays of char and it used NUL-padded 3-character
	string literals (i.e. 4-element initializers, with completely pointless
	zeroes at the end).

	That had been spotted by gcc-15[*]; prior to that gcc quietly dropped
	the 4th element of initializers.

	However, none of that had been needed in the first place - all this array
	is used for is checking that the first directory entry in root directory
	is "." and the second - "..".  The check had been expressed as a loop,
	using that match_root[] array.  Since there is no chance that we ever
	want to extend that list of entries, the entire thing is much too fancy
	for its own good; what we need is just a couple of explicit memcmp()
	and that's it.

	[*] <quoted warnings>

would explain what was really going on - the point is not to make gcc STFU, it's
to make the code more straightforward.  The warning is basically "it smells
somewhat fishy around >here<, might be worth taking a look".  And yes, it turned
out to be fishy; minimal "make it STFU" would be to strip those NULs from
the initializers (i.e. just go for static char match_root[2][3] = {".", ".."}; -
an array initializer is zero-padded if it's shorter than the array), but that
wasn't the only, er, oddity in that code.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ