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: f1f0f330b1
("ALSA: dice: add parameters of stream formats for models produced by TC Electronic")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:

committed by
Takashi Iwai

parent
ed14d9ae53
commit
ed1812c44c
@@ -75,13 +75,12 @@ int snd_dice_detect_tcelectronic_formats(struct snd_dice *dice)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
entry = NULL;
|
|
||||||
for (i = 0; i < ARRAY_SIZE(entries); ++i) {
|
for (i = 0; i < ARRAY_SIZE(entries); ++i) {
|
||||||
entry = entries + i;
|
entry = entries + i;
|
||||||
if (entry->model_id == model_id)
|
if (entry->model_id == model_id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!entry)
|
if (i == ARRAY_SIZE(entries))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
|
memcpy(dice->tx_pcm_chs, entry->spec->tx_pcm_chs,
|
||||||
|
Reference in New Issue
Block a user