浏览代码

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 <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
David Henningsson 12 年之前
父节点
当前提交
71aa5ebe36
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      sound/pci/hda/patch_realtek.c

+ 3 - 1
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];
 }