lkml.org 
[lkml]   [2020]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/4] power: supply: bq2515x: Introduce the bq2515x family
Hi Dan,

url: https://github.com/0day-ci/linux/commits/Dan-Murphy/BQ25150-155-Charger/20200110-055201
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/power/supply/bq2515x_charger.c:316 bq2515x_set_ilim_lvl() error: buffer overflow 'bq2515x_ilim_lvl_values' 8 <= 8

Old smatch warnings:
drivers/power/supply/bq2515x_charger.c:320 bq2515x_set_ilim_lvl() error: buffer overflow 'bq2515x_ilim_lvl_values' 8 <= 8
drivers/power/supply/bq2515x_charger.c:322 bq2515x_set_ilim_lvl() error: buffer overflow 'bq2515x_ilim_lvl_values' 8 <= 8

# https://github.com/0day-ci/linux/commit/f5918978695e4e465d54f5c34f356af86874b051
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f5918978695e4e465d54f5c34f356af86874b051
vim +/bq2515x_ilim_lvl_values +316 drivers/power/supply/bq2515x_charger.c

f5918978695e4e Dan Murphy 2020-01-08 311 static int bq2515x_set_ilim_lvl(struct bq2515x_device *bq2515x, int val)
f5918978695e4e Dan Murphy 2020-01-08 312 {
f5918978695e4e Dan Murphy 2020-01-08 313 int i;
f5918978695e4e Dan Murphy 2020-01-08 314
f5918978695e4e Dan Murphy 2020-01-08 315 for (i = 0; i <= ARRAY_SIZE(bq2515x_ilim_lvl_values); i++) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Typo. This should be < ARRAY_SIZE().

f5918978695e4e Dan Murphy 2020-01-08 @316 if (val == bq2515x_ilim_lvl_values[i])
f5918978695e4e Dan Murphy 2020-01-08 317 break;
f5918978695e4e Dan Murphy 2020-01-08 318
f5918978695e4e Dan Murphy 2020-01-08 319 if (val > bq2515x_ilim_lvl_values[i - 1] &&
f5918978695e4e Dan Murphy 2020-01-08 320 val < bq2515x_ilim_lvl_values[i]) {
f5918978695e4e Dan Murphy 2020-01-08 321 if (val - bq2515x_ilim_lvl_values[i - 1] <
f5918978695e4e Dan Murphy 2020-01-08 322 bq2515x_ilim_lvl_values[i] - val) {
f5918978695e4e Dan Murphy 2020-01-08 323 i = i - 1;
f5918978695e4e Dan Murphy 2020-01-08 324 break;
f5918978695e4e Dan Murphy 2020-01-08 325 }
f5918978695e4e Dan Murphy 2020-01-08 326 }
f5918978695e4e Dan Murphy 2020-01-08 327 }
f5918978695e4e Dan Murphy 2020-01-08 328
f5918978695e4e Dan Murphy 2020-01-08 329 return regmap_write(bq2515x->regmap, BQ2515X_ILIMCTRL, i);
f5918978695e4e Dan Murphy 2020-01-08 330 }

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation

\
 
 \ /
  Last update: 2020-01-13 11:34    [W:0.045 / U:27.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site