diff options
author | Daniel Mack <daniel@zonque.org> | 2014-10-07 08:25:13 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-10-07 08:34:25 -0400 |
commit | 897c329bcb2206dd025cdb7ba84831a4f3c872d0 (patch) | |
tree | a58a29af1e316491ddb6146ab0378dbb5e5a0d36 /sound | |
parent | 9d36a7dc4df6ef77cfc02ba78a10bc8577c2663f (diff) |
ALSA: usb: caiaq: check for cdev->n_streams > 1
Coverity spotted a possible DIV0 condition when cdev->n_streams is 0.
Fix this by making sure the value is > 1 in snd_usb_caiaq_audio_init().
Signed-off-by: Daniel Mack <daniel@zonque.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/usb/caiaq/audio.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c index 7103b0908d13..272844746135 100644 --- a/sound/usb/caiaq/audio.c +++ b/sound/usb/caiaq/audio.c | |||
@@ -816,6 +816,11 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev) | |||
816 | return -EINVAL; | 816 | return -EINVAL; |
817 | } | 817 | } |
818 | 818 | ||
819 | if (cdev->n_streams < 2) { | ||
820 | dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams); | ||
821 | return -EINVAL; | ||
822 | } | ||
823 | |||
819 | ret = snd_pcm_new(cdev->chip.card, cdev->product_name, 0, | 824 | ret = snd_pcm_new(cdev->chip.card, cdev->product_name, 0, |
820 | cdev->n_audio_out, cdev->n_audio_in, &cdev->pcm); | 825 | cdev->n_audio_out, cdev->n_audio_in, &cdev->pcm); |
821 | 826 | ||