diff mbox

ALSA: pcm: potential uninitialized return values

Message ID 20180327130752.GA31841@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter March 27, 2018, 1:07 p.m. UTC
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>

Comments

Takashi Iwai March 27, 2018, 1:21 p.m. UTC | #1
On Tue, 27 Mar 2018 15:07:52 +0200,
Dan Carpenter wrote:
> 
> 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>

Thanks, that's an oversight indeed.  Applied now.


Takashi
diff mbox

Patch

diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a9082f219561..40852c595453 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -1364,7 +1364,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))