diff options
author | Roel Kluin <roel.kluin@gmail.com> | 2009-11-10 14:11:55 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-11-11 02:07:05 -0500 |
commit | 71121d9fcc494453b9311992de220abb47dde3f1 (patch) | |
tree | 206f27537829d91f92cd80a0394ba3a77c3d7519 /sound/pci/hda/patch_realtek.c | |
parent | 4ac55982907e1d48e64feaa56be91b9b52d3714d (diff) |
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: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index d1ccb6eaf9fc..daf6975b0c2e 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -4684,9 +4684,9 @@ static int alc880_parse_auto_config(struct hda_codec *codec) | |||
4684 | spec->multiout.dig_out_nid = dig_nid; | 4684 | spec->multiout.dig_out_nid = dig_nid; |
4685 | else { | 4685 | else { |
4686 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | 4686 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
4687 | spec->slave_dig_outs[i - 1] = dig_nid; | 4687 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
4688 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) | ||
4689 | break; | 4688 | break; |
4689 | spec->slave_dig_outs[i - 1] = dig_nid; | ||
4690 | } | 4690 | } |
4691 | } | 4691 | } |
4692 | if (spec->autocfg.dig_in_pin) | 4692 | if (spec->autocfg.dig_in_pin) |
@@ -9813,9 +9813,9 @@ static int alc882_parse_auto_config(struct hda_codec *codec) | |||
9813 | spec->multiout.dig_out_nid = dig_nid; | 9813 | spec->multiout.dig_out_nid = dig_nid; |
9814 | else { | 9814 | else { |
9815 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; | 9815 | spec->multiout.slave_dig_outs = spec->slave_dig_outs; |
9816 | spec->slave_dig_outs[i - 1] = dig_nid; | 9816 | if (i >= ARRAY_SIZE(spec->slave_dig_outs) - 1) |
9817 | if (i == ARRAY_SIZE(spec->slave_dig_outs) - 1) | ||
9818 | break; | 9817 | break; |
9818 | spec->slave_dig_outs[i - 1] = dig_nid; | ||
9819 | } | 9819 | } |
9820 | } | 9820 | } |
9821 | if (spec->autocfg.dig_in_pin) | 9821 | if (spec->autocfg.dig_in_pin) |