diff options
author | Dan Carpenter | 2015-09-23 12:42:28 +0300 |
---|---|---|
committer | Takashi Iwai | 2015-09-24 11:46:25 +0200 |
commit | 145d92e77e6f34f53773fdb06789816ec2b6c7b3 (patch) | |
tree | 4c0ac01ee00cc28a07d8e67c7de643b90623b435 /sound/core | |
parent | 13f3a46d2a6cbdff1bbb06fac6de7dce753db8e1 (diff) |
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: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r-- | sound/core/pcm_native.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 75888dd38a7f..4863af5e7b26 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -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) |