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]
Date:   Mon, 28 Jan 2019 23:40:42 -0800
From:   Christoph Hellwig <hch@...radead.org>
To:     Jason Gunthorpe <jgg@...lanox.com>
Cc:     Christoph Hellwig <hch@...radead.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        NeilBrown <neilb@...e.com>, Jiri Kosina <trivial@...nel.org>
Subject: Re: [PATCH trivial] kernel.h: Make container_of_safe type safe

On Mon, Jan 28, 2019 at 06:44:24PM +0000, Jason Gunthorpe wrote:
> On Mon, Jan 28, 2019 at 05:42:42AM -0800, Christoph Hellwig wrote:
> > On Thu, Jan 24, 2019 at 08:55:05PM +0000, Jason Gunthorpe wrote:
> > > The final ternary expression is given void * and type * as arguments, so
> > > the resulting type of the macro ends up being void *.
> > > 
> > > container_of returns a type which maches the argument, this provides type
> > > safety and allows the expression to be immediately used as the target
> > > type.
> > > 
> > > Explicitly cast ERR_CAST() to get the correct type.
> > 
> > I think we should just kill off container_of_safe - it has no user
> > in the tree, is grossly misnamed and not really all that useful to start
> > with.
> 
> I see it open coded from time to time, here someone sent a patch
> open-coding it yesterday (with the same bug even):
> 
> https://patchwork.kernel.org/patch/10783535/
> 
> I noticed it didn't work right because I had a use for it..

And the patch is a good example for an anti-pattern to avoid, I'll
chime in there..

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ