[PATCH] ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The "entry" pointer is always non-NULL so this test for out of bounds
won't work.

Fixes: f1f0f330b1d0 ("ALSA: dice: add parameters of stream formats for models produced by TC Electronic")
Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

diff --git a/sound/firewire/dice/dice-tcelectronic.c b/sound/firewire/dice/dice-tcelectronic.c
index af8203b9d1a6..e134a5110c6c 100644
--- a/sound/firewire/dice/dice-tcelectronic.c
+++ b/sound/firewire/dice/dice-tcelectronic.c
@@ -75,13 +75,12 @@ int snd_dice_detect_tcelectronic_formats(struct snd_dice *dice)
 		}
 	}
 
-	entry = NULL;
 	for (i = 0; i < ARRAY_SIZE(entries); ++i) {
 		entry = entries + i;
 		if (entry->model_id == model_id)
 			break;
 	}
-	if (!entry)
+	if (i == ARRAY_SIZE(entries))
 		return -ENODEV;
 
 	memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux