public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()
@ 2018-05-18  9:16 Dan Carpenter
  2018-05-18 11:36 ` Takashi Sakamoto
  2018-05-18 11:39 ` Takashi Iwai
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-05-18  9:16 UTC (permalink / raw)
  To: Clemens Ladisch
  Cc: alsa-devel, Takashi Sakamoto, kernel-janitors, Takashi Iwai

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@oracle.com>

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,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-18 11:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18  9:16 [PATCH] ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats() Dan Carpenter
2018-05-18 11:36 ` Takashi Sakamoto
2018-05-18 11:39 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox