Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: hpp.iscas <hppiscas@163.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (mp5990) Publish the OF module aliases
Date: Sat, 05 Sep 2026 13:44:11 +0000	[thread overview]
Message-ID: <20260905134412.164601F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260905133721.65588-1-hppiscas@163.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Unsafe fallback matching logic causes a NULL pointer dereference when probed via ACPI PRP0001.
--

commit 8c03c546eec5de58e0c8478c39f38b64125e7713
Author: hpp.iscas <hppiscas@163.com>

hwmon: (mp5990) Publish the OF module aliases

MP5990 and MP5998 Device Tree clients are matched through mp5990_of_match. Only
the I2C ID table is currently published, although Device Tree clients emit OF
modalias events.

> diff --git a/drivers/hwmon/pmbus/mp5990.c b/drivers/hwmon/pmbus/mp5990.c
> index f8a5d1b42ff7a..d5143956d4780 100644
> --- a/drivers/hwmon/pmbus/mp5990.c
> +++ b/drivers/hwmon/pmbus/mp5990.c
> @@ -213,6 +213,7 @@ static const struct of_device_id mp5990_of_match[] = {
>  	{ .compatible = "mps,mp5998", .data = (void *)mp5998 },
>  	{}
>  };
> +MODULE_DEVICE_TABLE(of, mp5990_of_match);

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential NULL
pointer dereference in mp5990_probe():

drivers/hwmon/pmbus/mp5990.c:mp5990_probe() {
    ...
	if (client->dev.of_node)
		chip = (uintptr_t)of_device_get_match_data(&client->dev);
	else
		chip = i2c_match_id(mp5990_id, client)->driver_data;
    ...
}

If the driver is probed via an ACPI PRP0001 node, client->dev.of_node is NULL.
The probe function will fall back to the else branch and call i2c_match_id().

Because the client's name is derived from ACPI (e.g., 'PRP0001:00') and is
absent from mp5990_id, i2c_match_id() will return NULL.

Could the unconditional dereference of ->driver_data cause a kernel panic
in this scenario?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260905133721.65588-1-hppiscas@163.com?part=1

      reply	other threads:[~2026-09-05 13:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-05 13:37 [PATCH] hwmon: (mp5990) Publish the OF module aliases hpp.iscas
2026-09-05 13:44 ` 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=20260905134412.164601F00A3D@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=hppiscas@163.com \
    --cc=linux-hwmon@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox