tree:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head: 52a0bcb60e40f30211cb5cbbb0f582ec4e91d896
commit: 32e4978bb920d047fe5de3ea42d176f267c01f63 [1548/11541] power: supply: bq256xx:
Introduce the BQ256XX charger driver
config: x86_64-randconfig-m001-20210215 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp(a)intel.com>
Reported-by: Dan Carpenter <dan.carpenter(a)oracle.com>
smatch warnings:
drivers/power/supply/bq256xx_charger.c:1512 bq256xx_hw_init() error: buffer overflow
'bq256xx_watchdog_time' 8 <= 8
vim +/bq256xx_watchdog_time +1512 drivers/power/supply/bq256xx_charger.c
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1503 static int bq256xx_hw_init(struct
bq256xx_device *bq)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1504 {
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1505 struct power_supply_battery_info
bat_info = { };
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1506 int wd_reg_val =
BQ256XX_WATCHDOG_DIS;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1507 int ret = 0;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1508 int i;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1509
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1510 for (i = 0; i <
BQ256XX_NUM_WD_VAL; i++) {
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1511 if (bq->watchdog_timer >
bq256xx_watchdog_time[i] &&
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 @1512 bq->watchdog_timer <
bq256xx_watchdog_time[i + 1])
^^^^^
The static checker is worried about that "i + 1" can be
== BQ256XX_NUM_WD_VAL. Potentially the bq256xx_watchdog_time[] is
too high so this is impossible?
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1513 wd_reg_val = i;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1514 }
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1515 ret =
regmap_update_bits(bq->regmap, BQ256XX_CHARGER_CONTROL_1,
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1516 BQ256XX_WATCHDOG_MASK,
wd_reg_val <<
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1517 BQ256XX_WDT_BIT_SHIFT);
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org