diff options
author | Takashi Iwai <tiwai@suse.de> | 2006-11-08 09:48:43 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@server.perex.cz> | 2006-12-20 02:55:50 -0500 |
commit | c19bcdc64a13c6d7eedfdb46d705531e24e69cad (patch) | |
tree | 495ed0f8f3553905d74d0bc26352927591f6fdfd /sound/pci/ac97/ac97_patch.c | |
parent | b90d7760ea784f916cb1fc0d8123410f1f0c9194 (diff) |
[ALSA] ac97 - Fix potential negative array index
Fix the case cidx2 >= 0 and cidx2 < 0 which may result in negative
array index.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/ac97/ac97_patch.c')
-rw-r--r-- | sound/pci/ac97/ac97_patch.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c index f63025e99ab6..e813968e0cf8 100644 --- a/sound/pci/ac97/ac97_patch.c +++ b/sound/pci/ac97/ac97_patch.c | |||
@@ -1467,7 +1467,9 @@ static void patch_ad1881_chained(struct snd_ac97 * ac97, int unchained_idx, int | |||
1467 | snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); // ID1C | 1467 | snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); // ID1C |
1468 | ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002; | 1468 | ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002; |
1469 | if (cidx1 >= 0) { | 1469 | if (cidx1 >= 0) { |
1470 | if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C | 1470 | if (cidx2 < 0) |
1471 | patch_ad1881_chained1(ac97, cidx1, 0); | ||
1472 | else if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C | ||
1471 | patch_ad1881_chained1(ac97, cidx2, 0); | 1473 | patch_ad1881_chained1(ac97, cidx2, 0); |
1472 | else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C | 1474 | else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C |
1473 | patch_ad1881_chained1(ac97, cidx1, 0); | 1475 | patch_ad1881_chained1(ac97, cidx1, 0); |