Commit ed1812c4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Takashi Iwai

ALSA: dice: fix a bounds check in snd_dice_detect_tcelectronic_formats()

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

Fixes: f1f0f330 ("ALSA: dice: add parameters of stream formats for models produced by TC Electronic")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ed14d9ae
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment