[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.02.1307111538320.2458@chino.kir.corp.google.com>
Date: Thu, 11 Jul 2013 15:54:16 -0700 (PDT)
From: David Rientjes <rientjes@...gle.com>
To: Andrew Morton <akpm@...ux-foundation.org>
cc: Oleg Nesterov <oleg@...hat.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Mel Gorman <mgorman@...e.de>, Rik van Riel <riel@...hat.com>,
Andi Kleen <andi@...stfloor.org>, linux-kernel@...r.kernel.org,
Rusty Russell <rusty@...tcorp.com.au>
Subject: Re: [PATCH] mm: mempolicy: turn vma_set_policy() into
vma_dup_policy()
On Thu, 11 Jul 2013, Andrew Morton wrote:
> > PTR_ERR() may not imply IS_ERR(),
>
> Well why not. Are we saying that code can legitimately convert the
> PTR_ERR() return value back into a pointer? If so that sounds nuts.
>
ERR_PTR() is just delivering a payload that can be interpreted by
PTR_ERR(), Rusty has spotted places in the kernel that do this without
actual errno. The most obvious case for me is the ERR_PTR(-1UL) in
mm/oom_kill.c.
People delivering a non-errno payload shouldn't be using ERR_PTR(), but
nothing enforces that. You could add a WARN_ON_ONCE(error >= MAX_ERRNO).
But PTR_ERR() will still need to rely on IS_ERR().
I agree that these longs should be converted to ints, since errno is
defined to be int by the C standard.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists