[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1211475019-5596-2-git-send-email-marcin.slusarz@gmail.com>
Date: Thu, 22 May 2008 18:50:19 +0200
From: Marcin Slusarz <marcin.slusarz@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
Christoph Hellwig <hch@....de>,
Al Viro <viro@...IV.linux.org.uk>,
Alexey Dobriyan <adobriyan@...il.com>,
Johannes Weiner <hannes@...urebad.de>
Subject: [PATCH] ERR_PTR: warn when ERR_PTR parameter is valid argument
Check at runtime whether error argument of ERR_PTR is valid.
It can catch bugs which possibly lead to oops or panic earlier.
Currently there are > 600 calls of ERR_PTR with non-constant argument.
Signed-off-by: Marcin Slusarz <marcin.slusarz@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Christoph Hellwig <hch@....de>
Cc: Al Viro <viro@...IV.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@...il.com>
Cc: Johannes Weiner <hannes@...urebad.de>
---
include/linux/err.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/linux/err.h b/include/linux/err.h
index 4773ed3..f7e098e 100644
--- a/include/linux/err.h
+++ b/include/linux/err.h
@@ -3,6 +3,7 @@
#include <linux/compiler.h>
+#include <asm/bug.h>
#include <asm/errno.h>
/*
@@ -22,6 +23,7 @@
static inline void *__ERR_PTR(long error)
{
+ WARN_ON(!VALID_ERR_PTR_ARG(error));
return (void *) error;
}
--
1.5.4.5
--
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