提交 71aa5ebe 编写于 作者: D David Henningsson 提交者: Takashi Iwai

ALSA: hda - Always check array bounds in alc_get_line_out_pfx

Even when CONFIG_SND_DEBUG is not enabled, we don't want to
return an arbitrary memory location when the channel count is
larger than we expected.

Cc: stable@kernel.org
Signed-off-by: NDavid Henningsson <david.henningsson@canonical.com>
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 1f04661f
...@@ -2598,8 +2598,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, ...@@ -2598,8 +2598,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
return "PCM"; return "PCM";
break; break;
} }
if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) if (ch >= ARRAY_SIZE(channel_name)) {
snd_BUG();
return "PCM"; return "PCM";
}
return channel_name[ch]; return channel_name[ch];
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册