* [PATCH] ALSA: usb: caiaq: check for cdev->n_streams > 1
@ 2014-10-07 12:25 Daniel Mack
2014-10-07 12:45 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Mack @ 2014-10-07 12:25 UTC (permalink / raw)
To: alsa-devel; +Cc: tiwai, Daniel Mack
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>
---
sound/usb/caiaq/audio.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
index 7103b09..2728447 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)
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);
--
2.1.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: usb: caiaq: check for cdev->n_streams > 1
2014-10-07 12:25 [PATCH] ALSA: usb: caiaq: check for cdev->n_streams > 1 Daniel Mack
@ 2014-10-07 12:45 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2014-10-07 12:45 UTC (permalink / raw)
To: Daniel Mack; +Cc: alsa-devel
At Tue, 7 Oct 2014 14:25:13 +0200,
Daniel Mack wrote:
>
> 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>
Thanks, applied.
Takashi
> ---
> sound/usb/caiaq/audio.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/sound/usb/caiaq/audio.c b/sound/usb/caiaq/audio.c
> index 7103b09..2728447 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)
> 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);
>
> --
> 2.1.0
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-10-07 12:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-07 12:25 [PATCH] ALSA: usb: caiaq: check for cdev->n_streams > 1 Daniel Mack
2014-10-07 12:45 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.