Skip to content

Commit

Permalink
ASoC: Fix soc-cache buffer overflow bug
Browse files Browse the repository at this point in the history
Make sure we stay within the cache boundaries when updating the
register cache.

Signed-off-by: Dimitris Papastamos <[email protected]>
Acked-by: Liam Girdwood <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
Dimitris Papastamos authored and broonie committed Sep 22, 2010
1 parent cbfa518 commit d47372e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sound/soc/soc-cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d47372e

Please sign in to comment.