ALSA: pcm_native.c initialize drec and num_drecs before it get used
RFC PATCH 1/1 ALSA: pcm_native.c initialize drec and num_drecs before it get used
[This is untested]
drec and num_drecs is used uninitialized for nonblock(goto lock)
This also fixed following compilation warnings :
CC [M] sound/core/pcm_native.osound/core/pcm_native.c: In function ‘snd_pcm_drain’:sound/core/pcm_native.c:1413: warning: ‘drec’ may be used uninitialized in this function sound/core/pcm_native.c:1411: warning: ‘num_drecs’ may be used uninitialized in this function
--- sound/core/pcm_native.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)
sound/core/pcm_native.c +4 -3
@@ -1433,6 +1433,9 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, }else if (substream->f_flags &O_NONBLOCK ) nonblock =1 ; + drec = &drec_tmp; + num_drecs =0 ; +if (nonblock) goto lock;/* no need to allocate waitqueues */
@@ -1445,11 +1448,9 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,snd_power_unlock (card);return -ENOMEM ; } - }else - drec = &drec_tmp; + }/* count only playback streams */ - num_drecs =0 ;snd_pcm_group_for_each_entry (s, substream) { runtime = s->runtime;if (s->stream ==SNDRV_PCM_STREAM_PLAYBACK ) {
Signature · 7 lines
1.6.4.2 _______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
At Sat, 12 Sep 2009 23:47:45 +0530,
Quoted 11 lines · Jaswinder Singh Rajput
[This is untested]
drec and
num_drecsis used uninitialized for nonblock(goto lock)This also fixed following compilation warnings :
CC [M]
sound/core/pcm_native.osound/core/pcm_native.c: In function ‘snd_pcm_drain’:sound/core/pcm_native.c:1413: warning: ‘drec’ may be used uninitialized in this functionsound/core/pcm_native.c:1411: warning: ‘num_drecs’ may be used uninitialized in this function
This is false-positive.
I'm going to give another try to shut gcc out later.
thanks,
Takashi
Quoted 37 lines
Signed-off-by Jaswinder Singh Rajput <[email protected]>--- sound/core/pcm_native.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-)sound/core/pcm_native.c +4
-3@@ -1433,6 +1433,9 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, }else if (substream->f_flags &O_NONBLOCK ) nonblock =1 ; + drec = &drec_tmp; + num_drecs =0 ; +if (nonblock) goto lock;/* no need to allocate waitqueues */ @@ -1445,11 +1448,9 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream,snd_power_unlock (card);return -ENOMEM ; } - }else - drec = &drec_tmp; + }/* count only playback streams */ - num_drecs =0 ;snd_pcm_group_for_each_entry (s, substream) { runtime = s->runtime;if (s->stream ==SNDRV_PCM_STREAM_PLAYBACK ) {Signature · 1 line
1.6.4.2
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel