From: Christoph Hellwig <hch@infradead.org>
To: Liang Chen <liangchen.linux@gmail.com>
Cc: linux-bcache@vger.kernel.org, linux-kernel@vger.kernel.org,
colyli@suse.de, bcache@linux.ewheeler.net
Subject: Re: [PATCH] bcache: avoid a dangerous addressing in closure_queue
Date: Wed, 5 Jul 2017 12:31:43 -0700 [thread overview]
Message-ID: <20170705193143.GA1050@infradead.org> (raw)
In-Reply-To: <1499259199-15161-1-git-send-email-liangchen.linux@gmail.com>
On Wed, Jul 05, 2017 at 08:53:19PM +0800, Liang Chen wrote:
> The use of the union reduces the size of closure struct by taking advantage
> of the current size of its members. The offset of func in work_struct equals
> the size of the first three members, so that work.work_func will just
> reference the forth member - the pointer to closure_fn.
>
> This is smart but dangerous. It can be broken if work_struct or the other
> ones get changed, and can be a bit difficult to debug.
Please, don't ever cast function pointers, as that's extremely
dangerous.
next prev parent reply other threads:[~2017-07-05 19:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-05 12:53 [PATCH] bcache: avoid a dangerous addressing in closure_queue Liang Chen
2017-07-05 19:31 ` Christoph Hellwig [this message]
2017-07-06 0:18 ` Liang Chen
2017-07-06 3:36 ` 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=20170705193143.GA1050@infradead.org \
--to=hch@infradead.org \
--cc=bcache@linux.ewheeler.net \
--cc=colyli@suse.de \
--cc=liangchen.linux@gmail.com \
--cc=linux-bcache@vger.kernel.org \
--cc=linux-kernel@vger.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).