login
Login
/
Register
Search
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2007
»
July
»
3
Re: [PATCH][isapnp] Fix a potential NULL pointer dereference in isapnp_read_tag()
view
thread
!MAILaRCHIVE_VOTE_RePLACE
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From:
Andrew Morton <akpm@...>
To: Jesper Juhl <jesper.juhl@...>
Cc: Linux Kernel Mailing List <linux-kernel@...>, Jaroslav Kysela <perex@...>
Subject:
Re: [PATCH][isapnp] Fix a potential NULL pointer dereference in isapnp_read_tag()
Date: Tuesday, July 3, 2007 - 4:03 pm
On Sun, 1 Jul 2007 01:38:31 +0200 Jesper Juhl <jesper.juhl@gmail.com> wrote:
quoted text
> The Coverity checker spotted (as bug #809) that we dereference 'type' > long before we actually test it against NULL in > drivers/pnp/isapnp/core.c::isapnp_read_tag() - both branches of the > 'if (tag & 0x80)' dereference type, and since this 'if' is before the test > against NULL and the return of -1, this will blow up is ever type is NULL. > This is easy to fix by simply moving the NULL test to the beginning of > the function. > > > Signed-off-by: Jesper Juhl <jesper.juhl@gmail.com> > --- > > drivers/pnp/isapnp/core.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/Documentation/00-INDEX b/Documentation/00-INDEX > diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c > index a0b1587..5696924 100644 > --- a/drivers/pnp/isapnp/core.c > +++ b/drivers/pnp/isapnp/core.c > @@ -356,6 +356,8 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size) > { > unsigned char tag, tmp[2]; > > + if (!type) /* wrong type */ > + return -1; > isapnp_peek(&tag, 1); > if (tag == 0) /* invalid tag */ > return -1; > @@ -370,8 +372,6 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size) > #if 0 > printk(KERN_DEBUG "tag = 0x%x, type = 0x%x, size = %i\n", tag, *type, *size); > #endif > - if (type == 0) /* wrong type */ > - return -1; > if (*type == 0xff && *size == 0xffff) /* probably invalid data */ > return -1; > return 0;
dood, look at the callers. NULL is not possible here. -
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][isapnp] Fix a potential NULL pointer dereference in ...
, Jesper Juhl
, (Sat Jun 30, 7:38 pm)
Re: [PATCH][isapnp] Fix a potential NULL pointer dereference...
, Andrew Morton
, (Tue Jul 3, 4:03 pm)
Re: [PATCH][isapnp] Fix a potential NULL pointer dereference...
, Jesper Juhl
, (Tue Jul 3, 9:04 pm)
[PATCH][isapnp] Remove pointless check of 'type' against 0 i...
, Jesper Juhl
, (Wed Jul 4, 6:59 pm)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg Kroah-Hartman
[PATCH 002/196] Chinese: rephrase English introduction in HOWTO
David Brown
Re: Linux 2.6.21-rc2
James Bottomley
Re: Integration of SCST in the mainstream Linux kernel
Justin C. Sherrill
Re: dragonflybsd.org website link?
git
:
linux-netdev
:
Ben Hutchings
Re: [GIT]: Networking
Gerrit Renker
[PATCH 15/37] dccp: Set per-connection CCIDs via socket options
Jarek Poplawski
Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock().
openbsd-misc
:
Colocation donated by:
Who's online
There are currently
3 users
and
580 guests
online.
Online users
juegosiles
olecom
cristalyoung72
Syndicate