linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH-next] pcmcia: fix sparse integer as NULL pointer warning
@ 2008-07-24  1:34 Harvey Harrison
  2008-07-24  4:36 ` Stephen Rothwell
  0 siblings, 1 reply; 4+ messages in thread
From: Harvey Harrison @ 2008-07-24  1:34 UTC (permalink / raw)
  To: Dominik Brodowski; +Cc: linux-next

drivers/pcmcia/rsrc_nonstatic.c:278:30: warning: Using plain integer as NULL pointer

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/pcmcia/rsrc_nonstatic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index d0c1d63..31e6a03 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -275,7 +275,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
 		destroy_cis_cache(s);
 	}
 	s->cis_mem.res = NULL;
-	if ((ret != 0) || (count == 0))
+	if ((ret != 0) || (count == NULL))
 		return 0;
 	return 1;
 }
-- 
1.5.6.4.570.g052e

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH-next] pcmcia: fix sparse integer as NULL pointer warning
  2008-07-24  1:34 [PATCH-next] pcmcia: fix sparse integer as NULL pointer warning Harvey Harrison
@ 2008-07-24  4:36 ` Stephen Rothwell
  2008-07-24  5:00   ` Harvey Harrison
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Rothwell @ 2008-07-24  4:36 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Dominik Brodowski, linux-next

[-- Attachment #1: Type: text/plain, Size: 526 bytes --]

On Wed, 23 Jul 2008 18:34:08 -0700 Harvey Harrison <harvey.harrison@gmail.com> wrote:
>
> +++ b/drivers/pcmcia/rsrc_nonstatic.c
> @@ -275,7 +275,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
>  		destroy_cis_cache(s);
>  	}
>  	s->cis_mem.res = NULL;
> -	if ((ret != 0) || (count == 0))
> +	if ((ret != 0) || (count == NULL))

I was wondering if it should be
			   (*count == 0)

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH-next] pcmcia: fix sparse integer as NULL pointer warning
  2008-07-24  4:36 ` Stephen Rothwell
@ 2008-07-24  5:00   ` Harvey Harrison
  2008-07-28 14:53     ` Dominik Brodowski
  0 siblings, 1 reply; 4+ messages in thread
From: Harvey Harrison @ 2008-07-24  5:00 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: Dominik Brodowski, linux-next

On Thu, 2008-07-24 at 14:36 +1000, Stephen Rothwell wrote:
> On Wed, 23 Jul 2008 18:34:08 -0700 Harvey Harrison <harvey.harrison@gmail.com> wrote:
> >
> > +++ b/drivers/pcmcia/rsrc_nonstatic.c
> > @@ -275,7 +275,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
> >  		destroy_cis_cache(s);
> >  	}
> >  	s->cis_mem.res = NULL;
> > -	if ((ret != 0) || (count == 0))
> > +	if ((ret != 0) || (count == NULL))
> 
> I was wondering if it should be
> 			   (*count == 0)
> 

Actually, it looks that way as in this case count can never be none.

readable() is only called in one place where it is passed the addresses
of two local variables.  Looking at pccard_validate_cis(), the number
of valid tuples found is returned through the info pointer, or zero
if invalid cis is found.

So I'd say *count == 0 is probably right.

Dominik?

Harvey

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH-next] pcmcia: fix sparse integer as NULL pointer warning
  2008-07-24  5:00   ` Harvey Harrison
@ 2008-07-28 14:53     ` Dominik Brodowski
  0 siblings, 0 replies; 4+ messages in thread
From: Dominik Brodowski @ 2008-07-28 14:53 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Stephen Rothwell, linux-next

On Wed, Jul 23, 2008 at 10:00:05PM -0700, Harvey Harrison wrote:
> On Thu, 2008-07-24 at 14:36 +1000, Stephen Rothwell wrote:
> > On Wed, 23 Jul 2008 18:34:08 -0700 Harvey Harrison <harvey.harrison@gmail.com> wrote:
> > >
> > > +++ b/drivers/pcmcia/rsrc_nonstatic.c
> > > @@ -275,7 +275,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
> > >  		destroy_cis_cache(s);
> > >  	}
> > >  	s->cis_mem.res = NULL;
> > > -	if ((ret != 0) || (count == 0))
> > > +	if ((ret != 0) || (count == NULL))
> > 
> > I was wondering if it should be
> > 			   (*count == 0)
> > 
> 
> Actually, it looks that way as in this case count can never be none.
> 
> readable() is only called in one place where it is passed the addresses
> of two local variables.  Looking at pccard_validate_cis(), the number
> of valid tuples found is returned through the info pointer, or zero
> if invalid cis is found.
> 
> So I'd say *count == 0 is probably right.
> 
> Dominik?

Yes, *count == 0 is what we'd need to check here.

Thanks!

	Dominik

From: Dominik Brodowski <linux@dominikbrodowski.net>
Date: Mon, 28 Jul 2008 16:37:10 +0200
Subject: [PATCH 1/1] pcmcia: rsrc_nonstatic: check value, not pointer

Bug found by Harvey Harrison and Stephen Rothwell.

Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
---
 drivers/pcmcia/rsrc_nonstatic.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index d0c1d63..203e579 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -275,7 +275,7 @@ static int readable(struct pcmcia_socket *s, struct resource *res,
 		destroy_cis_cache(s);
 	}
 	s->cis_mem.res = NULL;
-	if ((ret != 0) || (count == 0))
+	if ((ret != 0) || (*count == 0))
 		return 0;
 	return 1;
 }
-- 
1.5.4.3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-07-28 14:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-07-24  1:34 [PATCH-next] pcmcia: fix sparse integer as NULL pointer warning Harvey Harrison
2008-07-24  4:36 ` Stephen Rothwell
2008-07-24  5:00   ` Harvey Harrison
2008-07-28 14:53     ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).