* [Patch] Uninitialized variable in drivers/scsi/ncr53c8xx.c
@ 2006-08-31 23:29 Eric Sesterhenn
2006-09-01 6:00 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Eric Sesterhenn @ 2006-08-31 23:29 UTC (permalink / raw)
To: linux-kernel; +Cc: matthew
hi,
this was spotted by coverity (id #880).
We use simple_strtoul() earlier to initialize pe,
if the function fails, it also does not initialize it.
Therefore we should initialize it ourselves, so the check
in the OPT_TAGS case "if (pe && *pe == '/')" makes sense, and
actually makes the command line parsing more robust.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.18-rc5/drivers/scsi/ncr53c8xx.c.orig 2006-09-01 01:25:09.000000000 +0200
+++ linux-2.6.18-rc5/drivers/scsi/ncr53c8xx.c 2006-09-01 01:25:26.000000000 +0200
@@ -692,7 +692,7 @@ static int __init sym53c8xx__setup(char
int xi = 0;
while (cur != NULL && (pc = strchr(cur, ':')) != NULL) {
- char *pe;
+ char *pe = NULL;
val = 0;
pv = pc;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] Uninitialized variable in drivers/scsi/ncr53c8xx.c
2006-08-31 23:29 [Patch] Uninitialized variable in drivers/scsi/ncr53c8xx.c Eric Sesterhenn
@ 2006-09-01 6:00 ` Andrew Morton
2006-09-01 15:45 ` Eric Sesterhenn
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Morton @ 2006-09-01 6:00 UTC (permalink / raw)
To: Eric Sesterhenn; +Cc: linux-kernel, matthew
On Fri, 01 Sep 2006 01:29:12 +0200
Eric Sesterhenn <snakebyte@gmx.de> wrote:
> hi,
>
> this was spotted by coverity (id #880).
> We use simple_strtoul() earlier to initialize pe,
> if the function fails, it also does not initialize it.
> Therefore we should initialize it ourselves, so the check
> in the OPT_TAGS case "if (pe && *pe == '/')" makes sense, and
> actually makes the command line parsing more robust.
>
> Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
simple_strtoul() always initialises `pe'.
> --- linux-2.6.18-rc5/drivers/scsi/ncr53c8xx.c.orig 2006-09-01 01:25:09.000000000 +0200
> +++ linux-2.6.18-rc5/drivers/scsi/ncr53c8xx.c 2006-09-01 01:25:26.000000000 +0200
> @@ -692,7 +692,7 @@ static int __init sym53c8xx__setup(char
> int xi = 0;
>
> while (cur != NULL && (pc = strchr(cur, ':')) != NULL) {
> - char *pe;
> + char *pe = NULL;
>
> val = 0;
> pv = pc;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Patch] Uninitialized variable in drivers/scsi/ncr53c8xx.c
2006-09-01 6:00 ` Andrew Morton
@ 2006-09-01 15:45 ` Eric Sesterhenn
0 siblings, 0 replies; 3+ messages in thread
From: Eric Sesterhenn @ 2006-09-01 15:45 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, matthew
On Thu, 2006-08-31 at 23:00 -0700, Andrew Morton wrote:
> On Fri, 01 Sep 2006 01:29:12 +0200
> Eric Sesterhenn <snakebyte@gmx.de> wrote:
>
> > hi,
> >
> > this was spotted by coverity (id #880).
> > We use simple_strtoul() earlier to initialize pe,
> > if the function fails, it also does not initialize it.
> > Therefore we should initialize it ourselves, so the check
> > in the OPT_TAGS case "if (pe && *pe == '/')" makes sense, and
> > actually makes the command line parsing more robust.
> >
> > Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
>
> simple_strtoul() always initialises `pe'.
D'oh. But i think we should apply the patch nevertheless,
to make the parsing code more robust, in case the command line is
screwed up (and simple_strtoul() is never called).
Eric
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-09-01 15:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-31 23:29 [Patch] Uninitialized variable in drivers/scsi/ncr53c8xx.c Eric Sesterhenn
2006-09-01 6:00 ` Andrew Morton
2006-09-01 15:45 ` Eric Sesterhenn
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).