diff options
author | Dimitris Papastamos <dp@opensource.wolfsonmicro.com> | 2010-09-21 10:03:26 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-09-22 07:01:05 -0400 |
commit | d47372e852391d0c6553dfbc7c4c56b89b527e13 (patch) | |
tree | 39319d653d6d29443de9392f89c30f6d1be27e36 /sound/soc/soc-cache.c | |
parent | cbfa5184cc5f58627f08c7fad225424f565b439d (diff) |
ASoC: Fix soc-cache buffer overflow bug
Make sure we stay within the cache boundaries when updating the
register cache.
Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-cache.c')
-rw-r--r-- | sound/soc/soc-cache.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index adbc68ce9050..15d2779074ef 100644 --- a/sound/soc/soc-cache.c +++ b/sound/soc/soc-cache.c | |||
@@ -203,8 +203,9 @@ static int snd_soc_8_16_write(struct snd_soc_codec *codec, unsigned int reg, | |||
203 | data[1] = (value >> 8) & 0xff; | 203 | data[1] = (value >> 8) & 0xff; |
204 | data[2] = value & 0xff; | 204 | data[2] = value & 0xff; |
205 | 205 | ||
206 | if (!snd_soc_codec_volatile_register(codec, reg)) | 206 | if (!snd_soc_codec_volatile_register(codec, reg) |
207 | reg_cache[reg] = value; | 207 | && reg < codec->driver->reg_cache_size) |
208 | reg_cache[reg] = value; | ||
208 | 209 | ||
209 | if (codec->cache_only) { | 210 | if (codec->cache_only) { |
210 | codec->cache_sync = 1; | 211 | codec->cache_sync = 1; |