ASoC: mediatek: mt8195: add dai id check before accessing array
authorTrevor Wu <trevor.wu@mediatek.com>
Tue, 7 Mar 2023 04:09:35 +0000 (12:09 +0800)
committerMark Brown <broonie@kernel.org>
Mon, 13 Mar 2023 14:08:37 +0000 (14:08 +0000)
commitff728899065922534d80170685fb807194d6487b
tree6c92f85855c4ea6d254cbb2535c15ebe68e5beda
parent4727d4d775654986913a21c35c7cfaf1ecdafd62
ASoC: mediatek: mt8195: add dai id check before accessing array

Coverity shows "afe_priv->dai_priv[dai_id] evaluates to an address that
could be at negative offset of an array.". Add dai id check before
accessing the array element. This ensures that the offset of an array must
be a valid index.

Signed-off-by: Trevor Wu <trevor.wu@mediatek.com>
Link: https://lore.kernel.org/r/20230307040938.7484-2-trevor.wu@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/mt8195/mt8195-dai-adda.c
sound/soc/mediatek/mt8195/mt8195-dai-etdm.c
sound/soc/mediatek/mt8195/mt8195-dai-pcm.c