提交 ed1812c4 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册