Skip to contentSkip to conversation

ALSA: snd-usb-caiaq: fix stream count check

PATCH Applied Daniel Mack 2 participants 2 messages Jan 4, 2015 – Jan 5, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: snd-usb-caiaq: fix stream count check

Commit 897c329bc ("ALSA: usb: caiaq: check for cdev->n_streams > 1") introduced a safety check to protect against bogus data provided by devices. However, the n_streams variable is already divided by CHANNELS_PER_STREAM, so the correct check is 'n_streams > 0'.

Fix this to un-break support for stereo devices.

---
 sound/usb/caiaq/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/caiaq/audio.c +1 -1
index 2728447..327f864 100644
@@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
 		return -EINVAL;
 	}
 
-	if (cdev->n_streams < 2) {
+	if (cdev->n_streams < 1) {
 		dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams);
 		return -EINVAL;
 	}
Signature · 1 line
2.2.0
Applied
#1 lore raw

At Sun, 4 Jan 2015 19:59:29 +0100,

Quoted 10 lines · Daniel Mack

Commit 897c329bc ("ALSA: usb: caiaq: check for cdev->n_streams > 1") introduced a safety check to protect against bogus data provided by devices. However, the n_streams variable is already divided by CHANNELS_PER_STREAM, so the correct check is 'n_streams > 0'.

Fix this to un-break support for stereo devices.

Applied, thanks.

Takashi

Quoted 20 lines
---
 sound/usb/caiaq/audio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/usb/caiaq/audio.c +1 -1
index 2728447..327f864 100644
@@ -816,7 +816,7 @@ int snd_usb_caiaq_audio_init(struct snd_usb_caiaqdev *cdev)
 		return -EINVAL;
 	}
 
-	if (cdev->n_streams < 2) {
+	if (cdev->n_streams < 1) {
 		dev_err(dev, "bogus number of streams: %d\n", cdev->n_streams);
 		return -EINVAL;
 	}
Signature · 1 line
2.2.0