* [patch] Staging: bcm2835-audio: fix an uninitialized return value
@ 2017-02-07 13:17 Dan Carpenter
2017-02-07 14:01 ` Arnd Bergmann
2017-02-07 14:15 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-02-07 13:17 UTC (permalink / raw)
To: kernel-janitors
"ret" isn't necessarily initialized on the success path.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
index 9ac1f72a178e..b7922be4909c 100644
--- a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c
@@ -432,6 +432,7 @@ static int bcm2835_audio_open_connection(struct bcm2835_alsa_stream *alsa_stream
alsa_stream->instance = instance;
LOG_DBG(" success !\n");
+ ret = 0;
err_free_mem:
LOG_DBG(" .. OUT\n");
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [patch] Staging: bcm2835-audio: fix an uninitialized return value
2017-02-07 13:17 [patch] Staging: bcm2835-audio: fix an uninitialized return value Dan Carpenter
@ 2017-02-07 14:01 ` Arnd Bergmann
2017-02-07 14:15 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2017-02-07 14:01 UTC (permalink / raw)
To: kernel-janitors
On Tue, Feb 7, 2017 at 2:17 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> "ret" isn't necessarily initialized on the success path.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
The patch seems correct, but do you have any idea why gcc-7 didn't
warn about this?
I assume that you found it with smatch, and nobody else did.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [patch] Staging: bcm2835-audio: fix an uninitialized return value
2017-02-07 13:17 [patch] Staging: bcm2835-audio: fix an uninitialized return value Dan Carpenter
2017-02-07 14:01 ` Arnd Bergmann
@ 2017-02-07 14:15 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2017-02-07 14:15 UTC (permalink / raw)
To: kernel-janitors
On Tue, Feb 07, 2017 at 03:01:23PM +0100, Arnd Bergmann wrote:
> On Tue, Feb 7, 2017 at 2:17 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> > "ret" isn't necessarily initialized on the success path.
> >
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> >
>
> The patch seems correct, but do you have any idea why gcc-7 didn't
> warn about this?
Heh... I'm not a gcc dev. Checking for uninitialized variables is
harder than I would have thought though..
> I assume that you found it with smatch, and nobody else did.
Yep. I'm getting close to releasing my uninitialized variable check.
I guess the one thing holding me back is that I still have tons of false
positives caused by mismatches between "if (ret)" and "if (ret < 0)"
where the function assumes that non-zero is an error but the caller
assumes that errors are negative.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-07 14:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-07 13:17 [patch] Staging: bcm2835-audio: fix an uninitialized return value Dan Carpenter
2017-02-07 14:01 ` Arnd Bergmann
2017-02-07 14:15 ` Dan Carpenter
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).