From: Dimitris Papastamos Date: Tue, 21 Sep 2010 14:03:26 +0000 (+0100) Subject: ASoC: Fix soc-cache buffer overflow bug X-Git-Tag: v2.6.36-rc8~16^2^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d47372e852391d0c6553dfbc7c4c56b89b527e13;p=platform%2Fkernel%2Flinux-3.10.git 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 Acked-by: Liam Girdwood Signed-off-by: Mark Brown --- diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c index adbc68c..15d2779 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, data[1] = (value >> 8) & 0xff; data[2] = value & 0xff; - if (!snd_soc_codec_volatile_register(codec, reg)) - reg_cache[reg] = value; + if (!snd_soc_codec_volatile_register(codec, reg) + && reg < codec->driver->reg_cache_size) + reg_cache[reg] = value; if (codec->cache_only) { codec->cache_sync = 1;