Skip to contentSkip to conversation

fix array overflow in ak4114.c

PATCH In review Darren Jenkins\ 2 participants 2 messages Apr 12, 2006 – Apr 13, 2006

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

PATCH 1/1 fix array overflow in ak4114.c

G'day list

Coverity found a static overflow in ak4114.c @ line 46.

After looking at this a little it seems like someone has typed in the wrong symbolic name (twice), as they were trying to save the TX state register info.

The patch below changes the relevant AK4114_REG_RXCSB0 values to AK4114_REG_TXCSB0. Which both makes more sense and fixes the array overflow.

sound/i2c/other/ak4114.c renamed from sound/i2c/other/ak4114.c.orig +2 -2
@@ -42,8 +42,8 @@ static void reg_write(struct ak4114 *ak4
 	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)

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors

#1 lore raw

Hi Darren,

sound/i2c/other/ak4114.c

Quoted 12 lines

Coverity found a static overflow in ak4114.c @ line 46.

After looking at this a little it seems like someone has typed in the wrong symbolic name (twice), as they were trying to save the TX state register info.

The patch below changes the relevant AK4114_REG_RXCSB0 values to AK4114_REG_TXCSB0. Which both makes more sense and fixes the array overflow.
(...)

sound/i2c/other/ak4114.c renamed from sound/i2c/other/ak4114.c.orig +0 -0

I'm not maintaining the sound drivers, so please don't Cc: me on this. The only case where I would be able (and willing) to help is when a bug actually involves the i2c part of a driver. Doesn't seem to be the case here.

Thanks,

Signature · 1 line
Jean Delvare

_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors