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: <20150203191038.GF10842@pengutronix.de>
Date:	Tue, 3 Feb 2015 20:10:38 +0100
From:	Uwe Kleine-König 
	<u.kleine-koenig@...gutronix.de>
To:	David Howells <dhowells@...hat.com>
Cc:	"'linux-arch@...r.kernel.org'" <linux-arch@...r.kernel.org>,
	"'linux@....linux.org.uk'" <linux@....linux.org.uk>,
	"Wang, Yalin" <Yalin.Wang@...ymobile.com>,
	"'arnd@...db.de'" <arnd@...db.de>,
	"'linux-kernel@...r.kernel.org'" <linux-kernel@...r.kernel.org>,
	"'linux-arm-kernel@...ts.infradead.org'" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [RFC] change non-atomic bitops method

Hello,

[added some more context again]

On Tue, Feb 03, 2015 at 03:14:43PM +0000, David Howells wrote:
> > > -     *p  |= mask;
> > > +     if ((*p & mask) == 0)
> > > +             *p  |= mask;
> > Care to fix the double space here while touching the code?
> > 
> > I think the more natural check here is:
> > 
> >         if ((~*p & mask) != 0)
> >                 *p |= mask;
> >
> > Might be a matter of taste, but this check is equivalent to
> > 
> > 	*p != (*p | mask)
> > 
> > which is what you really want to test for.
> I would argue that this is less clear as to what's going on.
OK, I admit that this equivalence is not obvious. Then maybe let the
compiler find the equivalence and do:

-	*p  |= mask;
+	if (*p != (*p | mask))
+		p |= mask;

?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
--
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