From: Ingo Molnar <mingo@elte.hu>
To: Jens Axboe <jens.axboe@oracle.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Jeremy Fitzhardinge <jeremy@goop.org>,
Tejun Heo <htejun@gmail.com>,
Arjan van de Ven <arjan@infradead.org>,
Hugh Dickins <hugh@veritas.com>,
linux-kernel@vger.kernel.org, akpm@linux-foundation.org
Subject: Re: [PATCH] Fix kunmap() argument in sg_miter_stop
Date: Tue, 18 Nov 2008 09:27:15 +0100 [thread overview]
Message-ID: <20081118082715.GH17838@elte.hu> (raw)
In-Reply-To: <20081117182650.GY26778@kernel.dk>
* Jens Axboe <jens.axboe@oracle.com> wrote:
> On Mon, Nov 17 2008, Linus Torvalds wrote:
> >
> >
> > On Mon, 17 Nov 2008, Jens Axboe wrote:
> > >
> > > Any opinions on the kunmap/kunmap_atomic pointer checking? It's a bit
> > > ugly that we have to enforce a void * rule for kunmap_atomic(),
> >
> > I don't think that's a "bit ugly". I think it's unacceptable.
> >
> > Making sure we pass in "struct page" to kunmap() sounds good, but the
> > kunmap_atomic() part just sounds insane.
>
> It's been the primary source of bugs that I have seen. The xen and
> sg iter bug were kunmap() variants though, but otherwise I've mostly
> seen the opposite. But it is ugly, no doubt about it. I can't think
> of a better way to attempt to warn about it though, so if you really
> dislike it I'll just drop the _atomic() bits.
The main ugliness comes from the tons of void * type casts that the
kunmap_atomic() type check forces. Type casts are just as dangerous
(and ugly) as type mismatches. (more dangerous in fact)
Perhaps we could try an opt-in 'type filter' approach instead. See
kernel/tracing/trace.h's trace_assign_type()'s type checking magic for
an example of how to do it.
( but it's a bit tricky here because we want to filter void * from
struct page * - i'm not sure gcc will recognize them as incompatible
types. )
Ingo
prev parent reply other threads:[~2008-11-18 8:27 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-15 19:27 [PATCH] Fix kunmap() argument in sg_miter_stop Arjan van de Ven
2008-11-15 20:15 ` Hugh Dickins
2008-11-15 20:27 ` Arjan van de Ven
2008-11-15 20:39 ` Arjan van de Ven
2008-11-16 5:16 ` Tejun Heo
2008-11-17 8:11 ` Jens Axboe
2008-11-17 8:22 ` Ingo Molnar
2008-11-17 8:30 ` Jens Axboe
2008-11-17 8:50 ` Ingo Molnar
2008-11-17 8:58 ` Jens Axboe
2008-11-17 9:34 ` Jens Axboe
2008-11-17 9:41 ` Ingo Molnar
2008-11-17 9:45 ` Jens Axboe
2008-11-17 11:13 ` Jens Axboe
2008-11-17 17:08 ` Jeremy Fitzhardinge
2008-11-17 17:10 ` Ingo Molnar
2008-11-17 17:15 ` Jeremy Fitzhardinge
2008-11-17 17:25 ` Linus Torvalds
2008-11-17 17:35 ` Jeremy Fitzhardinge
2008-11-17 18:14 ` [PATCH] xen: fix scrub_page() Ingo Molnar
2008-11-17 18:07 ` [PATCH] Fix kunmap() argument in sg_miter_stop Jens Axboe
2008-11-17 18:16 ` Linus Torvalds
2008-11-17 18:26 ` Jens Axboe
2008-11-18 8:27 ` Ingo Molnar [this message]
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=20081118082715.GH17838@elte.hu \
--to=mingo@elte.hu \
--cc=akpm@linux-foundation.org \
--cc=arjan@infradead.org \
--cc=htejun@gmail.com \
--cc=hugh@veritas.com \
--cc=jens.axboe@oracle.com \
--cc=jeremy@goop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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