All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Dan Murphy <dmurphy@ti.com>
Cc: kbuild-all@lists.01.org, sebastian.reichel@collabora.com,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dan Murphy <dmurphy@ti.com>
Subject: Re: [PATCH v3 4/4] power: supply: bq2515x: Introduce the bq2515x family
Date: Mon, 13 Jan 2020 13:33:20 +0300	[thread overview]
Message-ID: <20200113103320.GA9488@kadam> (raw)
In-Reply-To: <20200108202314.11791-5-dmurphy@ti.com>

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

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org
Subject: Re: [PATCH v3 4/4] power: supply: bq2515x: Introduce the bq2515x family
Date: Mon, 13 Jan 2020 13:33:20 +0300	[thread overview]
Message-ID: <20200113103320.GA9488@kadam> (raw)
In-Reply-To: <20200108202314.11791-5-dmurphy@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2749 bytes --]

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(a)lists.01.org Intel Corporation

WARNING: multiple messages have this Message-ID (diff)
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v3 4/4] power: supply: bq2515x: Introduce the bq2515x family
Date: Mon, 13 Jan 2020 13:33:20 +0300	[thread overview]
Message-ID: <20200113103320.GA9488@kadam> (raw)
In-Reply-To: <20200108202314.11791-5-dmurphy@ti.com>

[-- Attachment #1: Type: text/plain, Size: 2749 bytes --]

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(a)lists.01.org Intel Corporation

  reply	other threads:[~2020-01-13 10:33 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-08 20:23 [PATCH v3 0/4] BQ25150/155 Charger Dan Murphy
2020-01-08 20:23 ` [PATCH v3 1/4] power: supply: core: Update sysfs-class-power ABI document Dan Murphy
2020-01-08 20:23 ` [PATCH v3 2/4] power_supply: Add additional health properties to the header Dan Murphy
2020-01-08 20:23 ` [PATCH v3 3/4] dt-bindings: power: Add the bq2515x family dt bindings Dan Murphy
2020-01-08 20:23 ` [PATCH v3 4/4] power: supply: bq2515x: Introduce the bq2515x family Dan Murphy
2020-01-13 10:33   ` Dan Carpenter [this message]
2020-01-13 10:33     ` Dan Carpenter
2020-01-13 10:33     ` 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=20200113103320.GA9488@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=dmurphy@ti.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sebastian.reichel@collabora.com \
    /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.