diff options
author | Jean Delvare <khali@linux-fr.org> | 2007-02-05 15:07:04 +0300 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2007-02-09 11:03:55 +0300 |
commit | 1ab774e049085da6facfaf3b24d54158c3f0f5b3 (patch) | |
tree | 3a266d2a2b1f3d1c46e2fca44f3353c4f9886b4b | |
parent | 66e27788a33636cf0d9bf22eb9d56a7f4ffa3a84 (diff) | |
download | linux-1ab774e049085da6facfaf3b24d54158c3f0f5b3.tar.xz |
[ALSA] snd-ak4114: Fix two array overflows
Fix the handling of the TXCSB registers cache. There was one array
overflow in reg_write() and one in snd_ak4114_reg_write(). Thanks
to David Binderman for reporting the latter.
The second overflow probably doesn't matter much, given that the
function snd_ak4114_reg_write() appears to be never called. I wonder
why it exists and why it is exported.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r-- | sound/i2c/other/ak4114.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index d2b17c83fd33..adbfd5884d06 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -42,8 +42,8 @@ static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char va ak4114->write(ak4114->private_data, reg, val); if (reg <= AK4114_REG_INT1_MASK) ak4114->regmap[reg] = val; - else if (reg >= AK4114_REG_RXCSB0 && reg <= AK4114_REG_TXCSB4) - ak4114->txcsb[reg-AK4114_REG_RXCSB0] = val; + else if (reg >= AK4114_REG_TXCSB0 && reg <= AK4114_REG_TXCSB4) + ak4114->txcsb[reg-AK4114_REG_TXCSB0] = val; } static inline unsigned char reg_read(struct ak4114 *ak4114, unsigned char reg) @@ -127,7 +127,8 @@ void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char if (reg <= AK4114_REG_INT1_MASK) reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val); else if (reg >= AK4114_REG_TXCSB0 && reg <= AK4114_REG_TXCSB4) - reg_write(chip, reg, (chip->txcsb[reg] & ~mask) | val); + reg_write(chip, reg, + (chip->txcsb[reg-AK4114_REG_TXCSB0] & ~mask) | val); } void snd_ak4114_reinit(struct ak4114 *chip) |