Commit 145d92e7 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: core: check for underflow in snd_pcm_sw_params()

As far as I can see, having an invalid ->tstamp_mode is harmless, but
adding a check silences a static checker warning.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 13f3a46d
...@@ -650,7 +650,8 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream, ...@@ -650,7 +650,8 @@ static int snd_pcm_sw_params(struct snd_pcm_substream *substream,
} }
snd_pcm_stream_unlock_irq(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; return -EINVAL;
if (params->proto >= SNDRV_PROTOCOL_VERSION(2, 0, 12) && if (params->proto >= SNDRV_PROTOCOL_VERSION(2, 0, 12) &&
params->tstamp_type > SNDRV_PCM_TSTAMP_TYPE_LAST) params->tstamp_type > SNDRV_PCM_TSTAMP_TYPE_LAST)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment