[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240830034640.7049-2-kfting@nuvoton.com>
Date: Fri, 30 Aug 2024 11:46:34 +0800
From: Tyrone Ting <warp5tw@...il.com>
To: avifishman70@...il.com,
tmaimon77@...il.com,
tali.perry1@...il.com,
venture@...gle.com,
yuenn@...gle.com,
benjaminfair@...gle.com,
andi.shyti@...nel.org,
andriy.shevchenko@...ux.intel.com,
wsa@...nel.org,
rand.sec96@...il.com,
wsa+renesas@...g-engineering.com,
warp5tw@...il.com,
tali.perry@...oton.com,
Avi.Fishman@...oton.com,
tomer.maimon@...oton.com,
KWLIU@...oton.com,
JJLIU0@...oton.com,
kfting@...oton.com
Cc: openbmc@...ts.ozlabs.org,
linux-i2c@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH v2 1/7] i2c: npcm: restore slave addresses array length
The smatch check warning is "buffer overflow 'npcm_i2caddr' 2 <= 9".
The original design supports 10 slave addresses although only 2
addresses are required for current implementation.
Restore the npcm_i2caddr array length to fix the smatch warning.
Fixes: 47d506d1a28f ("i2c: npcm: Remove own slave addresses 2:10")
Reported-by: Dan Carpenter <dan.carpenter@...aro.org>
Closes: https://lore.kernel.org/r/202408130818.FgDP5uNm-lkp@intel.com/
Signed-off-by: Tyrone Ting <kfting@...oton.com>
---
drivers/i2c/busses/i2c-npcm7xx.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/i2c/busses/i2c-npcm7xx.c b/drivers/i2c/busses/i2c-npcm7xx.c
index 2fe68615942e..bbcb4d6668ce 100644
--- a/drivers/i2c/busses/i2c-npcm7xx.c
+++ b/drivers/i2c/busses/i2c-npcm7xx.c
@@ -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
--
2.34.1
Powered by blists - more mailing lists