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] [day] [month] [year] [list]
Message-Id: <20190527192356.GN28207@linux.ibm.com>
Date:   Mon, 27 May 2019 12:23:56 -0700
From:   "Paul E. McKenney" <paulmck@...ux.ibm.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Andrea Parri <andrea.parri@...rulasolutions.com>,
        linux-kernel@...r.kernel.org,
        Josh Triplett <josh@...htriplett.org>,
        Steven Rostedt <rostedt@...dmis.org>,
        Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Joel Fernandes <joel@...lfernandes.org>, rcu@...r.kernel.org,
        Peter Zijlstra <peterz@...radead.org>,
        Will Deacon <will.deacon@....com>,
        Mark Rutland <mark.rutland@....com>,
        Matthew Wilcox <willy@...radead.org>,
        Sasha Levin <sashal@...nel.org>, apw@...onical.com
Subject: Re: [PATCH v2] rcu: Don't return a value from rcu_assign_pointer()

On Mon, May 27, 2019 at 10:57:52AM -0700, Joe Perches wrote:
> On Mon, 2019-05-27 at 10:49 -0700, Paul E. McKenney wrote:
> > On Mon, May 27, 2019 at 10:21:22AM -0700, Joe Perches wrote:
> > > On Mon, 2019-05-27 at 09:10 -0700, Paul E. McKenney wrote:
> > > > On Mon, May 27, 2019 at 10:49:57AM +0200, Andrea Parri wrote:
> > > > > Quoting Paul [1]:
> > > > > 
> > > > >   "Given that a quick (and perhaps error-prone) search of the uses
> > > > >    of rcu_assign_pointer() in v5.1 didn't find a single use of the
> > > > >    return value, let's please instead change the documentation and
> > > > >    implementation to eliminate the return value."
> > > > > 
> > > > > [1] https://lkml.kernel.org/r/20190523135013.GL28207@linux.ibm.com
> > > > 
> > > > Queued, thank you!
> > > > 
> > > > Adding the checkpatch maintainers on CC as well.  The "do { } while
> > > > (0)" prevents the return value from being used, by design.  Given the
> > > > checkpatch complaint, is there some better way to achieve this?
> > > 
> > > Not sure what the checkpatch complaint is here.
> > 
> > Checkpatch seems to want at least two statements in each
> > "do { } while (0)" macro definition:
> > 
> > WARNING: Single statement macros should not use a do {} while (0) loop
> > 
> > > Reading the link above, there seems to be a compiler warning.
> > 
> > The compiler warning is a theoretical issue that is being fixed by this
> > patch, and the patch is giving the checkpatch warning.
> > 
> > > Perhaps a statement expression macro with no return value?
> > > 
> > > #define rcu_assign_pointer(p, v)	({ (p) = (v); ; })
> > 
> > This is at best an acquired taste for me...
> 
> Another ugly possibility could be:
> 
> #define rcu_assign_pointer(p, v) do {if (1) (p) = (v); } while (0)

And, not to be left out, another ugly possibility might be:

#define rcu_assign_pointer(p, v) ((void)((p) = (v)))

> Possibly the best option would be to ignore checkpatch here
> and just add a comment above the use.

Works for me!

							Thanx, Paul

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ