login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
May
»
22
Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not errno value
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From:
Marcin Slusarz <marcin.slusarz@...>
To: Johannes Weiner <hannes@...>
Cc: Alexey Dobriyan <adobriyan@...>, LKML <linux-kernel@...>, Andrew Morton <akpm@...>, Al Viro <viro@...>, Christoph Hellwig <hch@...>
Subject:
Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not errno value
Date: Thursday, May 22, 2008 - 12:08 pm
On Mon, May 19, 2008 at 02:11:21PM +0200, Johannes Weiner wrote:
quoted text
> Hi, > > Alexey Dobriyan <adobriyan@gmail.com> writes: > > > On Mon, May 19, 2008 at 01:13:20AM +0200, Johannes Weiner wrote: > >> Marcin Slusarz <marcin.slusarz@gmail.com> writes: > >> > >> > Check at runtime whether error argument of ERR_PTR and ERR_OR_0_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 > >> > in Linux kernel sources. > > > >> > --- 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> > >> > > >> > /* > >> > @@ -21,6 +22,7 @@ > >> > > >> > static inline void *__ERR_PTR(long error) > >> > { > >> > + WARN_ON(!IS_ERR_VALUE(error)); > >> > return (void *) error; > >> > } > >> > > >> > @@ -28,6 +30,7 @@ static inline void *__ERR_PTR(long error) > >> > > >> > static inline void *__ERR_OR_0_PTR(long error) > >> > { > >> > + WARN_ON(!IS_ERR_VALUE(error) && error); > >> > return (void *) error; > >> > } > >> > >> How about WARN_ON_ONCE() instead? That would warn once for each erroneous user > >> which should be enough. > > > > And blow up .bss ? > > Well, okay. Perhaps ratelimiting? I really prefer a bigger image size > over a spammed dmesg.
Well, when I add 0 as a valid argument for ERR_PTR, this check won't add too many false positives, so I think simple WARN_ON is safe. Marcin --
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
[PATCH] let ERR_PTR BUILD_BUG_ON when we know its argument i...
, Marcin Slusarz
, (Sun May 11, 4:12 pm)
Re: [PATCH] let ERR_PTR BUILD_BUG_ON when we know its argume...
, Andrew Morton
, (Mon May 12, 7:38 pm)
Re: [PATCH] let ERR_PTR BUILD_BUG_ON when we know its argume...
, Marcin Slusarz
, (Tue May 13, 4:18 pm)
[PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not errn...
, Marcin Slusarz
, (Sun May 18, 6:04 pm)
Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not ...
, Johannes Weiner
, (Sun May 18, 7:13 pm)
Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not ...
, Alexey Dobriyan
, (Mon May 19, 2:43 am)
Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not ...
, Johannes Weiner
, (Mon May 19, 8:11 am)
Re: [PATCH 6/6] ERR_PTR: warn when ERR_PTR parameter is not ...
, Marcin Slusarz
, (Thu May 22, 12:08 pm)
[PATCH 5/6] vfs: fix ERR_PTR abuse in generic_readlink
, Marcin Slusarz
, (Sun May 18, 6:03 pm)
[PATCH 4/6] procfs: switch ERR_PTR to ERR_OR_0_PTR when "err...
, Marcin Slusarz
, (Sun May 18, 6:03 pm)
[PATCH 3/6] vfs: open_exec cleanup
, Marcin Slusarz
, (Sun May 18, 6:01 pm)
Re: [PATCH 3/6] vfs: open_exec cleanup
, Christoph Hellwig
, (Mon May 19, 1:53 am)
Re: [PATCH 3/6] vfs: open_exec cleanup
, Marcin Slusarz
, (Thu May 22, 11:57 am)
[PATCH 2/6] ERR_PTR: add ERR_OR_0_PTR
, Marcin Slusarz
, (Sun May 18, 6:01 pm)
Re: [PATCH 2/6] ERR_PTR: add ERR_OR_0_PTR
, Christoph Hellwig
, (Mon May 19, 1:55 am)
Re: [PATCH 2/6] ERR_PTR: add ERR_OR_0_PTR
, Al Viro
, (Mon May 19, 2:33 am)
Re: [PATCH 2/6] ERR_PTR: add ERR_OR_0_PTR
, Johannes Weiner
, (Sun May 18, 7:04 pm)
[PATCH 1/6] ERR_PTR: if errno value is known at compile time...
, Marcin Slusarz
, (Sun May 18, 5:56 pm)
Re: [PATCH 1/6] ERR_PTR: if errno value is known at compile ...
, Alexey Dobriyan
, (Mon May 19, 2:38 am)
Re: [PATCH 1/6] ERR_PTR: if errno value is known at compile ...
, Marcin Slusarz
, (Thu May 22, 12:03 pm)
[PATCH 0/6] Sanity checks for ERR_PTR argument
, Marcin Slusarz
, (Sun May 18, 5:56 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Benjamin Herrenschmidt
Re: [linux-pm] [PATCH] Remove process freezer from suspend to RAM pathway
Ulrich Drepper
Re: [patch 7/8] fdmap v2 - implement sys_socket2
Washington Odhiambo
Weird Problem with NAT - more details
Greg Kroah-Hartman
[PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO
git
:
linux-netdev
:
Gerrit Renker
[PATCH 27/37] dccp: Integration of dynamic feature activation - part 2 (server side)
Frans Pop
svc: failed to register lockdv1 RPC service (errno 97).
Jarek Poplawski
[PATCH take 2] pkt_sched: Protect gen estimators under est_lock.
David Miller
Re: [GIT]: Networking
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
5 users
and
577 guests
online.
Online users
strcmp
feldemaya33
honeyairtuz
ackes
aquaracer13
Syndicate