From: kernel test robot <lkp@intel.com>
To: kbuild@lists.01.org
Subject: [linux-next:master 1548/11541] drivers/power/supply/bq256xx_charger.c:1512 bq256xx_hw_init() error: buffer overflow 'bq256xx_watchdog_time' 8 <= 8
Date: Tue, 16 Feb 2021 05:07:30 +0800 [thread overview]
Message-ID: <202102160527.uL5opsbg-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 7411 bytes --]
CC: kbuild-all(a)lists.01.org
CC: Linux Memory Management List <linux-mm@kvack.org>
TO: "Ricardo Rivera-Matos" <r-rivera-matos@ti.com>
CC: Sebastian Reichel <sre@kernel.org>
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
:::::: branch date: 12 hours ago
:::::: commit date: 6 weeks ago
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 1502
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])
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);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1518
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1519 ret = power_supply_get_battery_info(bq->charger, &bat_info);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1520 if (ret) {
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1521 dev_warn(bq->dev, "battery info missing, default values will be applied\n");
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1522
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1523 bat_info.constant_charge_current_max_ua =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1524 bq->chip_info->bq256xx_def_ichg;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1525
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1526 bat_info.constant_charge_voltage_max_uv =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1527 bq->chip_info->bq256xx_def_vbatreg;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1528
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1529 bat_info.precharge_current_ua =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1530 bq->chip_info->bq256xx_def_iprechg;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1531
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1532 bat_info.charge_term_current_ua =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1533 bq->chip_info->bq256xx_def_iterm;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1534
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1535 bq->init_data.ichg_max =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1536 bq->chip_info->bq256xx_max_ichg;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1537
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1538 bq->init_data.vbatreg_max =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1539 bq->chip_info->bq256xx_max_vbatreg;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1540 } else {
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1541 bq->init_data.ichg_max =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1542 bat_info.constant_charge_current_max_ua;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1543
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1544 bq->init_data.vbatreg_max =
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1545 bat_info.constant_charge_voltage_max_uv;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1546 }
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1547
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1548 ret = bq->chip_info->bq256xx_set_vindpm(bq, bq->init_data.vindpm);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1549 if (ret)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1550 return ret;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1551
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1552 ret = bq->chip_info->bq256xx_set_iindpm(bq, bq->init_data.iindpm);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1553 if (ret)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1554 return ret;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1555
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1556 ret = bq->chip_info->bq256xx_set_ichg(bq,
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1557 bat_info.constant_charge_current_max_ua);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1558 if (ret)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1559 return ret;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1560
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1561 ret = bq->chip_info->bq256xx_set_iprechg(bq,
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1562 bat_info.precharge_current_ua);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1563 if (ret)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1564 return ret;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1565
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1566 ret = bq->chip_info->bq256xx_set_vbatreg(bq,
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1567 bat_info.constant_charge_voltage_max_uv);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1568 if (ret)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1569 return ret;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1570
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1571 ret = bq->chip_info->bq256xx_set_iterm(bq,
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1572 bat_info.charge_term_current_ua);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1573 if (ret)
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1574 return ret;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1575
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1576 power_supply_put_battery_info(bq->charger, &bat_info);
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1577
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1578 return 0;
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1579 }
32e4978bb920d0 Ricardo Rivera-Matos 2021-01-06 1580
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 30996 bytes --]
next reply other threads:[~2021-02-15 21:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-15 21:07 kernel test robot [this message]
-- strict thread matches above, loose matches on Subject: below --
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
2021-02-16 9:16 ` Dan Carpenter
2021-02-16 9:16 ` Dan Carpenter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202102160527.uL5opsbg-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.