Commit 71121d9f authored by Roel Kluin's avatar Roel Kluin Committed by Takashi Iwai

ALSA: hda - possible read past array alc88[02]_parse_auto_config()

The test of index `i' is after the read - too late - and
unsafe: if snd_hda_get_connections() fails in the last
iteration a read beyond the array is possible.
Signed-off-by: default avatarRoel Kluin <roel.kluin@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 4ac55982
...@@ -4684,9 +4684,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec) ...@@ -4684,9 +4684,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec)
spec->multiout.dig_out_nid = dig_nid; spec->multiout.dig_out_nid = dig_nid;
else { else {
spec->multiout.slave_dig_outs = spec->slave_dig_outs; spec->multiout.slave_dig_outs = spec->slave_dig_outs;
spec->slave_dig_outs[i - 1] = dig_nid; if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
break; break;
spec->slave_dig_outs[i - 1] = dig_nid;
} }
} }
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
...@@ -9813,9 +9813,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec) ...@@ -9813,9 +9813,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
spec->multiout.dig_out_nid = dig_nid; spec->multiout.dig_out_nid = dig_nid;
else { else {
spec->multiout.slave_dig_outs = spec->slave_dig_outs; spec->multiout.slave_dig_outs = spec->slave_dig_outs;
spec->slave_dig_outs[i - 1] = dig_nid; if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1)
if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1)
break; break;
spec->slave_dig_outs[i - 1] = dig_nid;
} }
} }
if (spec->autocfg.dig_in_pin) if (spec->autocfg.dig_in_pin)
......
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