* [linux-next:master 1548/11541] drivers/power/supply/bq256xx_charger.c:1512 bq256xx_hw_init() error: buffer overflow 'bq256xx_watchdog_time' 8 <= 8
@ 2021-02-16 9:16 Dan Carpenter
0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2021-02-16 9:16 UTC (permalink / raw)
To: kbuild, Ricardo Rivera-Matos
Cc: lkp, kbuild-all, Linux Memory Management List, Sebastian Reichel
[-- Attachment #1: Type: text/plain, Size: 2411 bytes --]
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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30996 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-02-16 9:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-16 9:16 [linux-next:master 1548/11541] drivers/power/supply/bq256xx_charger.c:1512 bq256xx_hw_init() error: buffer overflow 'bq256xx_watchdog_time' 8 <= 8 Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox