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:	Mon, 16 Feb 2009 22:30:01 +0000
From:	Al Viro <viro@...IV.linux.org.uk>
To:	chas3@...rs.sourceforge.net
Cc:	Roel Kluin <roel.kluin@...il.com>, netdev@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: [PATCH] ATM: misplaced parentheses?

On Mon, Feb 16, 2009 at 05:02:36PM -0500, Chas Williams (CONTRACTOR) wrote:
> that doesnt seem to make sense either.  the original code
> is:
> 
>  		for (i = 128; i != 0; i >>= 1) {   /* write command out */
> ...
>  			tmp = (lanai->conf1 & ~CONFIG1_PROMDATA) |
> 			    (data & i) ? CONFIG1_PROMDATA : 0;
> 
> since i is always positive here, you wouldnt need the ?: if your suggested
> fix is the original intent.  it looks like setting CONFIG1_PROMDATA
> means '1' and not setting it means '0' when writing the value of data
> to the register.

What the hell does it have to do with i being positive?  || variant is,
of course, silly; it's very obvious what's going on here.  Garden-variety
bit-banging, IOW
  			tmp = (lanai->conf1 & ~CONFIG1_PROMDATA) |
 			    ((data & i) ? CONFIG1_PROMDATA : 0);
and while you technically only need parens around ?:, in this case it's
better to keep it fully parenthesised - more readable that way.

The lack of parens around ?: in the current tree is an obvious bug.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ