Skip to content

Commit 8f65c45

Browse files
warp5twAndi Shyti
authored andcommitted
i2c: npcm: restore slave addresses array length
The smatch check warning is "buffer overflow 'npcm_i2caddr' 2 <= 9". The original design supports 10 target addresses although only 2 addresses are required for current implementation. Restore the npcm_i2caddr array length to fix the smatch warning. Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Tyrone Ting <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Signed-off-by: Andi Shyti <[email protected]>
1 parent 016b221 commit 8f65c45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/i2c/busses/i2c-npcm7xx.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,13 @@ enum i2c_addr {
136136
* Since the addr regs are sprinkled all over the address space,
137137
* use this array to get the address or each register.
138138
*/
139-
#define I2C_NUM_OWN_ADDR 2
139+
#define I2C_NUM_OWN_ADDR 10
140140
#define I2C_NUM_OWN_ADDR_SUPPORTED 2
141141

142142
static const int npcm_i2caddr[I2C_NUM_OWN_ADDR] = {
143-
NPCM_I2CADDR1, NPCM_I2CADDR2,
143+
NPCM_I2CADDR1, NPCM_I2CADDR2, NPCM_I2CADDR3, NPCM_I2CADDR4,
144+
NPCM_I2CADDR5, NPCM_I2CADDR6, NPCM_I2CADDR7, NPCM_I2CADDR8,
145+
NPCM_I2CADDR9, NPCM_I2CADDR10,
144146
};
145147
#endif
146148

0 commit comments

Comments
 (0)