ALSA: usb: caiaq: check for cdev->n_streams > 1
Subsystems (2)
PATCH 1/1 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 <[email protected]>
--- sound/usb/caiaq/audio.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/usb/caiaq/audio.c +5 -0
@@ -816,6 +816,11 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)return -EINVAL ; } +if (cdev->n_streams <2 ) { +dev_err (dev,"bogus number of streams: %d\n" , cdev->n_streams); +return -EINVAL ; + } + ret =snd_pcm_new (cdev->chip.card, cdev->product_name,0 , cdev->n_audio_out, cdev->n_audio_in, &cdev->pcm);
Signature · 1 line
2.1.0
Takashi Iwai
AppliedAt Tue, 7 Oct 2014 14:25:13 +0200,
Quoted 6 lines · Daniel Mack
Coverity spotted a possible DIV0 condition when
cdev->n_streamsis 0.Fix this by making sure the value is > 1 in
snd_usb_caiaq_audio_init().Signed-off-by Daniel Mack <[email protected]>
Thanks, applied.
Takashi
Quoted 23 lines
--- sound/usb/caiaq/audio.c | 5 +++++ 1 file changed, 5 insertions(+)sound/usb/caiaq/audio.c +5
-0@@ -816,6 +816,11 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)return -EINVAL ; } +if (cdev->n_streams <2 ) { +dev_err (dev,"bogus number of streams: %d\n" , cdev->n_streams); +return -EINVAL ; + } + ret =snd_pcm_new (cdev->chip.card, cdev->product_name,0 , cdev->n_audio_out, cdev->n_audio_in, &cdev->pcm);Signature · 1 line
2.1.0