aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2013-01-16 05:45:35 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-16 05:56:36 -0500
commitb56fa1ed09615f148271045d220b1c55580bdfc9 (patch)
tree5d0f543f3c3b7ada3756506dc57726464c84deea /sound/pci
parentea46c3c87c35b90139b4dca43917d0f605d568ed (diff)
ALSA: hda - Check array bounds in get_input_path
This gives us some additional safety. Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_generic.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index e878a9effc96..1fa71acc348d 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -2403,8 +2403,16 @@ static int create_input_ctls(struct hda_codec *codec)
2403static struct nid_path *get_input_path(struct hda_codec *codec, int adc_idx, int imux_idx) 2403static struct nid_path *get_input_path(struct hda_codec *codec, int adc_idx, int imux_idx)
2404{ 2404{
2405 struct hda_gen_spec *spec = codec->spec; 2405 struct hda_gen_spec *spec = codec->spec;
2406 if (imux_idx < 0 || imux_idx >= HDA_MAX_NUM_INPUTS) {
2407 snd_BUG();
2408 return NULL;
2409 }
2406 if (spec->dyn_adc_switch) 2410 if (spec->dyn_adc_switch)
2407 adc_idx = spec->dyn_adc_idx[imux_idx]; 2411 adc_idx = spec->dyn_adc_idx[imux_idx];
2412 if (adc_idx < 0 || adc_idx >= AUTO_CFG_MAX_OUTS) {
2413 snd_BUG();
2414 return NULL;
2415 }
2408 return snd_hda_get_path_from_idx(codec, spec->input_paths[imux_idx][adc_idx]); 2416 return snd_hda_get_path_from_idx(codec, spec->input_paths[imux_idx][adc_idx]);
2409} 2417}
2410 2418