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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to