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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20091025183939.GB10898@khazad-dum.debian.net>
Date:	Sun, 25 Oct 2009 16:39:39 -0200
From:	Henrique de Moraes Holschuh <hmh@....eng.br>
To:	André Goddard Rosa <andre.goddard@...il.com>
Cc:	gregkh@...e.de, alan@...ux.intel.com,
	Andrew Morton <akpm@...ux-foundation.org>, adobriyan@...il.com,
	linux list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] serial: cascade needless conditionals

On Sun, 25 Oct 2009, André Goddard Rosa wrote:
> On 10/25/09, Henrique de Moraes Holschuh <hmh@....eng.br> wrote:
> > On Sun, 25 Oct 2009, André Goddard Rosa wrote:
> >>  	if (flags == UPF_SPD_HI)
> >>  		altbaud = 57600;
> >> -	if (flags == UPF_SPD_VHI)
> >> +	else if (flags == UPF_SPD_VHI)
> >>  		altbaud = 115200;
> >> -	if (flags == UPF_SPD_SHI)
> >> +	else if (flags == UPF_SPD_SHI)
> >>  		altbaud = 230400;
> >> -	if (flags == UPF_SPD_WARP)
> >> +	else if (flags == UPF_SPD_WARP)
> >>  		altbaud = 460800;
> >
> > This changes code behaviour if more than one bit is set (which might never
> > happen for all I know...).  You should invert the order of the tests if you
> > want to make sure it is side-effect-free.
> 
> Do you mind explaining why? Notice that it's not (var & flag), it's =='.
> Can flags be equal more than one flag at the same time?

No, I obviously am going through coffee withdrawal :(  Sorry about this.

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh
--
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