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]
Date:   Tue, 28 Nov 2017 19:10:07 +0100 (CET)
From:   Thomas Gleixner <tglx@...utronix.de>
To:     "Gustavo A. R. Silva" <garsilva@...eddedor.com>
cc:     Ingo Molnar <mingo@...hat.com>, "H. Peter Anvin" <hpa@...or.com>,
        x86@...nel.org, linux-kernel@...r.kernel.org,
        Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH] x86/syscalls: Mark expected switch fall-throughs

On Tue, 28 Nov 2017, Gustavo A. R. Silva wrote:
> Quoting Thomas Gleixner <tglx@...utronix.de>:
> 
> > On Mon, 27 Nov 2017, Gustavo A. R. Silva wrote:
> > 
> > > In preparation to enabling -Wimplicit-fallthrough, mark switch cases
> > > where we are expecting to fall through.
> > 
> > > 		case 0:
> > > 			if (!n--) break;
> > > 			*args++ = regs->bx;
> > > +			/* fall through */
> > 
> > And these gazillions of pointless comments help enabling of
> > -Wimplicit-fallthrough in which way?
> > 
> 
> The -Wimplicit-fallthrough option was added to GCC 7. We want to add that
> option to the top-level Makefile so we can have the compiler help us not make
> mistakes as missing "break"s or "continue"s. This also documents the intention
> for humans and provides a way for analyzers to report issues or ignore False
> Positives.
> 
> So prior to adding such option to the Makefile, we have to properly add a code
> comment wherever the code is intended to fall through.
> 
> During the process of placing these comments I have identified actual bugs
> (missing "break"s/"continue"s) in a variety of components in the kernel, so I
> think this effort is valuable. Lastly, such a simple comment in the code can
> save a person plenty of time during a code review.

To be honest, such comments annoy me during a code review especially when
the fallthrough is so obvious as in this case. There might be cases where
its worth to document because it's non obvious, but documenting the obvious
just for the sake of documenting it is just wrong.

Thanks,

	tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ