ALSA: pcm: potential uninitialized return values
authorDan Carpenter <dan.carpenter@oracle.com>
Tue, 27 Mar 2018 13:07:52 +0000 (16:07 +0300)
committerBen Hutchings <ben@decadent.org.uk>
Thu, 31 May 2018 23:30:25 +0000 (00:30 +0100)
commit 5607dddbfca774fb38bffadcb077fe03aa4ac5c6 upstream.

Smatch complains that "tmp" can be uninitialized if we do a zero size
write.

Fixes: 02a5d6925cd3 ("ALSA: pcm: Avoid potential races between OSS ioctls and read/write")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/core/oss/pcm_oss.c

index 15ae278..5343f34 100644 (file)
@@ -1367,7 +1367,7 @@ static ssize_t snd_pcm_oss_write2(struct snd_pcm_substream *substream, const cha
 static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const char __user *buf, size_t bytes)
 {
        size_t xfer = 0;
-       ssize_t tmp;
+       ssize_t tmp = 0;
        struct snd_pcm_runtime *runtime = substream->runtime;
 
        if (atomic_read(&substream->mmap_count))
@@ -1474,7 +1474,7 @@ static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf,
 static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __user *buf, size_t bytes)
 {
        size_t xfer = 0;
-       ssize_t tmp;
+       ssize_t tmp = 0;
        struct snd_pcm_runtime *runtime = substream->runtime;
 
        if (atomic_read(&substream->mmap_count))