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: <alpine.LFD.0.999.0707171110540.27353@woody.linux-foundation.org>
Date:	Tue, 17 Jul 2007 11:14:51 -0700 (PDT)
From:	Linus Torvalds <torvalds@...ux-foundation.org>
To:	Randy Dunlap <randy.dunlap@...cle.com>
cc:	Ingo Molnar <mingo@...e.hu>, Jeremy Fitzhardinge <jeremy@...p.org>,
	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>, stable@...nel.org,
	Greg KH <greg@...ah.com>, Chris Wright <chrisw@...s-sol.org>
Subject: Re: [patch] fix the softlockup watchdog to actually work



On Tue, 17 Jul 2007, Randy Dunlap wrote:
>
> > +	if ((print_timestamp >= touch_timestamp &&
> > +			print_timestamp < (touch_timestamp + 1)) ||
> > +			did_panic || !per_cpu(watchdog_task, this_cpu)) {
> >  		return;
> > +	}
> >  
> >  	/* do not print during early bootup: */
> >  	if (unlikely(system_state != SYSTEM_RUNNING)) {
> 
> patch contains unneeded braces { }.

When there are issues with indentation, those braces are actually not 
unneeded any more, except for the compiler.

Just _look_ at the code. The indentation is not obvious, because the 
if-conditional itself is multiple lines, and indented (arguably wrongly so 
too, but that's another issue).

So it's no longer a trivial one-liner statement, it's a "multi-statement" 
spread out over multiple lines, and I think the braces are actually a good 
idea for things like that.

I also encourage people do do braces when you have nested indentation, ie

	if (something)
		if (somethingelse)
			return;

is actively *wrong*, while

	if (something) {
		if (somethingelse)
			return;
	}

is right, even though the braces are "unnecessary". Again, it's about the 
visual representation, not about whether the compiler needs them or not.

		Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ