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] [day] [month] [year] [list]
Date:	Tue, 21 Oct 2014 20:34:32 +0000
From:	"Rustad, Mark D" <mark.d.rustad@...el.com>
To:	Andrew Morton <akpm@...ux-foundation.org>
CC:	"Eric W. Biederman" <ebiederm@...ssion.com>,
	"Kirsher, Jeffrey T" <jeffrey.t.kirsher@...el.com>,
	"mingo@...nel.org" <mingo@...nel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] kernel/sysctl: Resolve missing-field-initializers
 warnings

On Oct 21, 2014, at 12:07 PM, Andrew Morton <akpm@...ux-foundation.org> wrote:

> On Sat, 18 Oct 2014 17:39:10 -0700 ebiederm@...ssion.com (Eric W. Biederman) wrote:
> 
>> Jeff Kirsher <jeffrey.t.kirsher@...el.com> writes:
>> 
>>> From: Mark Rustad <mark.d.rustad@...el.com>
>>> 
>>> Resolve missing-field-initializers warnings in W=2 builds by
>>> using designated initialization.
>> 
>> ick.  No.
>> 
>> That gcc warning makes no sense.  In this case heeding it makes the code
>> significantly uglier and significantly more confusing.
>> 
> 
> Yeah, it's not pretty.
> 
>>> --- a/kernel/sysctl.c
>>> +++ b/kernel/sysctl.c
>>> @@ -257,7 +257,7 @@ static struct ctl_table sysctl_base_table[] = {
>>> 		.mode		= 0555,
>>> 		.child		= dev_table,
>>> 	},
>>> -	{ }
>>> +	{ .procname = NULL }
>>> };
> 
> We use { } to mean "all zero" in 12 squillion places.  Do they all warn
> or is there something special about this site?

Well, about 6 squillion of them are { }, a GCC extension, and the other 6 squillion are { 0 }. Both forms generate the warning. There is nothing special about this site. I just was resolving warnings in order to find some that had some significance. A flood of 125,000 warnings is too awful to look at. I got it down to around 1,500 and did find a few hazards and sent patches to address them, which have been accepted in one form or another.

I had sent patches to add diagnostic control macros to allow a warning to be turned off for a range of code. I would have liked to use them to provide something like a ZERO_ENTRY macro that would have looked something like this:

#define ZERO_ENTRY DIAG_PUSH DIAG_IGNORE(missing-field-initializers) { 0 } DIAG_POP

which would have provided a standard way to get a zero entry that would have avoided the warnings. Borislav was quite opposed to the notion of diagnostic control macros. I rather like the notion as long as their use is tightly controlled.

I'm sure that we both feel that there should be a form that the compiler does not generate this warning for as a preferred solution. The designated initialization is at best a 3rd-best solution, though naming the field used to identify the end of the table is not a bad thing either.

I do like enabling lots of additional warnings to find problems in code, but when it results in such a flood of messages it is not a very useful approach, hence my tendency to want to address them somehow, so that meaningful ones can be noticed.

-- 
Mark Rustad, Networking Division, Intel Corporation


Download attachment "signature.asc" of type "application/pgp-signature" (842 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ