From: sashiko-bot@kernel.org
To: "Prachoday Sutar" <prachodaysutar7@gmail.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH] dt-bindings: power: supply: bq27xxx: Add BQ27Z558
Date: Thu, 26 Nov 2026 19:25:06 +0000 [thread overview]
Message-ID: <sashiko-outbox-236089@kernel.org> (raw)
In-Reply-To: <20261126191906.25708-1-prachodaysutar7@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] dt-bindings: power: supply: bq27xxx: NULL deref in
bq27xxx_battery_i2c_probe()
--
commit 54d1a3afdd53a67243b18d9017c27b2cdf3485cd
Author: Prachoday Sutar <prachodaysutar7@gmail.com>
dt-bindings: power: supply: bq27xxx: Add BQ27Z558
This commit adds the "ti,bq27z558" compatible string to the bq27xxx fuel
gauge device tree binding with "ti,bq27z561" as a fallback.
> diff --git a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
> index be0f1f7292c8f..28b04732e08d9 100644
> --- a/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/bq27xxx.yaml
> @@ -18,40 +18,44 @@ description: |
>
> properties:
> compatible:
[ ... ]
> + - items:
> + - const: ti,bq27z558
> + - const: ti,bq27z561
>
> reg:
> maxItems: 1
[Severity: High]
Does binding via the "ti,bq27z561" fallback trigger a NULL pointer
dereference in bq27xxx_battery_i2c_probe()?
When the I2C core creates the client from Device Tree,
of_i2c_get_board_info() -> of_alias_from_compatible() populates
client->name from the first compatible string ("bq27z558"). During probe,
bq27xxx_battery_i2c_of_match_table matches the "ti,bq27z561" fallback, but
its entries do not set .data:
drivers/power/supply/bq27xxx_battery_i2c.c:bq27xxx_battery_i2c_probe() {
const struct i2c_device_id *id = i2c_client_get_device_id(client);
...
name = devm_kasprintf(&client->dev, GFP_KERNEL, "%s-%ld", id->name, num);
...
di->chip = id->driver_data;
}
Because "bq27z558" is not in bq27xxx_i2c_id_table,
i2c_client_get_device_id(client) returns NULL and probe crashes
dereferencing id->name and id->driver_data.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261126191906.25708-1-prachodaysutar7@gmail.com?part=1
prev parent reply other threads:[~2026-11-26 19:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-26 19:19 [PATCH] dt-bindings: power: supply: bq27xxx: Add BQ27Z558 Prachoday Sutar
2026-11-26 19:25 ` sashiko-bot [this message]
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=sashiko-outbox-236089@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=prachodaysutar7@gmail.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.