Commit 4bd0ee76 authored by David Henningsson's avatar David Henningsson Committed by Ben Hutchings

ALSA: hda - Always check array bounds in alc_get_line_out_pfx

commit 71aa5ebe upstream.

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.
Signed-off-by: default avatarDavid Henningsson <david.henningsson@canonical.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 66a0d04a
...@@ -2665,8 +2665,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, ...@@ -2665,8 +2665,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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment