From: Jason Gunthorpe <jgg@mellanox.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
NeilBrown <neilb@suse.com>, Jiri Kosina <trivial@kernel.org>
Subject: Re: [PATCH trivial] kernel.h: Make container_of_safe type safe
Date: Mon, 28 Jan 2019 18:44:24 +0000 [thread overview]
Message-ID: <20190128184417.GM25120@mellanox.com> (raw)
In-Reply-To: <20190128134242.GA10951@infradead.org>
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..
Jason
next prev parent reply other threads:[~2019-01-28 18:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-24 20:55 [PATCH trivial] kernel.h: Make container_of_safe type safe Jason Gunthorpe
2019-01-28 13:42 ` Christoph Hellwig
2019-01-28 18:44 ` Jason Gunthorpe [this message]
2019-01-29 7:40 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190128184417.GM25120@mellanox.com \
--to=jgg@mellanox.com \
--cc=hch@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=neilb@suse.com \
--cc=trivial@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).