lkml.org 
[lkml]   [2008]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] let ERR_PTR BUILD_BUG_ON when we know its argument is not a valid errno
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>
---
allmodconfig compile tested (on x86_64)
should be applied after:
net/sunrpc/xprtrdma: fix svc_rdma_create out of memory error path
jfs: 0 is not valid errno value
---
include/linux/err.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/include/linux/err.h b/include/linux/err.h
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -19,11 +19,13 @@

#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)

-static inline void *ERR_PTR(long error)
+static inline void *__ERR_PTR(long error)
{
return (void *) error;
}

+#define ERR_PTR(error) (BUILD_BUG_ON(!IS_ERR_VALUE(error)), __ERR_PTR(error))
+
static inline long PTR_ERR(const void *ptr)
{
return (long) ptr;
--

\
 
 \ /
  Last update: 2008-05-11 22:15    [from the cache]
©2003-2011 Jasper Spaans