Skip to contentSkip to conversation

ALSA: pcm: harmless underflow issue in snd_pcm_sw_params()

PATCH In review Dan Carpenter 2 participants 3 messages Oct 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: pcm: harmless underflow issue in snd_pcm_sw_params()

"params->tstamp_mode" is a user supplied int. We cap the maximum but allow negative values by mistake. It's harmless but static checkers complain.

sound/core/pcm_native.c +2 -1
index 75888dd..4863af5 100644
@@ -650,7 +650,8 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
 	}
 	snd_pcm_stream_unlock_irq(substream);
 
-	if (params->tstamp_mode > SNDRV_PCM_TSTAMP_LAST)
+	if (params->tstamp_mode < 0 ||
+	    params->tstamp_mode > SNDRV_PCM_TSTAMP_LAST)
 		return -EINVAL;
 	if (params->proto >= SNDRV_PROTOCOL_VERSION(2, 0, 12) &&
 	    params->tstamp_type > SNDRV_PCM_TSTAMP_TYPE_LAST)
#1 lore raw
Quoted 6 lines · Dan Carpenter

"params->tstamp_mode" is a user supplied int. We cap the maximum but allow negative values by mistake. It's harmless but static checkers complain.

You already sent the same fix and it was applied in the commit 145d92e77e6f.

thanks,

Takashi

Quoted 16 lines
sound/core/pcm_native.c +2 -1
index 75888dd..4863af5 100644
@@ -650,7 +650,8 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
 	}
 	snd_pcm_stream_unlock_irq(substream);
 
-	if (params->tstamp_mode > SNDRV_PCM_TSTAMP_LAST)
+	if (params->tstamp_mode < 0 ||
+	    params->tstamp_mode > SNDRV_PCM_TSTAMP_LAST)
 		return -EINVAL;
 	if (params->proto >= SNDRV_PROTOCOL_VERSION(2, 0, 12) &&
 	    params->tstamp_type > SNDRV_PCM_TSTAMP_TYPE_LAST)
#2 lore raw
Quoted 12 lines · Takashi Iwai
Quoted 6 lines · Dan Carpenter

"params->tstamp_mode" is a user supplied int. We cap the maximum but allow negative values by mistake. It's harmless but static checkers complain.

You already sent the same fix and it was applied in the commit 145d92e77e6f.

Oops. Sorry about that.

regards,
dan carpenter