From: David Henningsson Date: Wed, 17 Oct 2012 10:43:44 +0000 (+0200) Subject: ALSA: hda - Always check array bounds in alc_get_line_out_pfx X-Git-Tag: upstream/snapshot3+hdmi~6205^2~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71aa5ebe36a4e936eff281b375a4707b6a8320f2;p=platform%2Fadaptation%2Frenesas_rcar%2Frenesas_kernel.git 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: David Henningsson Signed-off-by: Takashi Iwai --- diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 8253b4e..48d9d60 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -2598,8 +2598,10 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, return "PCM"; break; } - if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) + if (ch >= ARRAY_SIZE(channel_name)) { + snd_BUG(); return "PCM"; + } return channel_name[ch]; }