mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-19 12:50:21 +02:00
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 <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/r/202408130818.FgDP5uNm-lkp@intel.com/ Signed-off-by: Tyrone Ting <kfting@nuvoton.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
This commit is contained in:
parent
016b221209
commit
8f65c4552d
|
@ -136,11 +136,13 @@ enum i2c_addr {
|
|||
* Since the addr regs are sprinkled all over the address space,
|
||||
* use this array to get the address or each register.
|
||||
*/
|
||||
#define I2C_NUM_OWN_ADDR 2
|
||||
#define I2C_NUM_OWN_ADDR 10
|
||||
#define I2C_NUM_OWN_ADDR_SUPPORTED 2
|
||||
|
||||
static const int npcm_i2caddr[I2C_NUM_OWN_ADDR] = {
|
||||
NPCM_I2CADDR1, NPCM_I2CADDR2,
|
||||
NPCM_I2CADDR1, NPCM_I2CADDR2, NPCM_I2CADDR3, NPCM_I2CADDR4,
|
||||
NPCM_I2CADDR5, NPCM_I2CADDR6, NPCM_I2CADDR7, NPCM_I2CADDR8,
|
||||
NPCM_I2CADDR9, NPCM_I2CADDR10,
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user