Skip to contentSkip to conversation

da7210: Fencepost error in reg cache read

PATCH Applied Phil Carmody 3 participants 3 messages Apr 14, 2010 – Apr 20, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 da7210: Fencepost error in reg cache read

From: Phil Carmody <[email protected]>

An index equal to the array size may not be accessed.

---
 sound/soc/codecs/da7210.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
sound/soc/codecs/da7210.c +1 -1
index 366daf1..96932a8 100644
@@ -165,7 +165,7 @@ static const u8 da7210_reg[] = {
 static inline u32 da7210_read_reg_cache(struct snd_soc_codec *codec, u32 reg)
 {
 	u8 *cache = codec->reg_cache;
-	BUG_ON(reg > ARRAY_SIZE(da7210_reg));
+	BUG_ON(reg >= ARRAY_SIZE(da7210_reg));
 	return cache[reg];
 }
 
Signature · 1 line
1.6.0.4