Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Vincent Jardin" <vjardin@free.fr>
Cc: linux-hwmon@vger.kernel.org, conor+dt@kernel.org,
	robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5 3/3] hwmon: pmbus: add MPQ8646 driver
Date: Fri, 24 Jul 2026 00:06:43 +0000	[thread overview]
Message-ID: <20260724000643.E60C81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260724-mpq8646_v0-v5-3-5915b5ae9aa2@free.fr>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Stack variables passed to i2c_transfer() can cause memory corruption or panics with CONFIG_VMAP_STACK.
--

--- Patch [3]: [PATCH v5 3/3] hwmon: pmbus: add MPQ8646 driver ---
commit 1098fecfca1c29b33a174b200465134bc5be4be8
Author: Vincent Jardin <vjardin@free.fr>

hwmon: pmbus: add MPQ8646 driver

Add a new single-chip driver for the MPS MPQ8646 that is a PMBus device.
The driver adds extended bits decode, alarm acknowledge, gate-close retry,
and an in-driver alarm-poll fallback.

> diff --git a/drivers/hwmon/pmbus/mpq8646.c b/drivers/hwmon/pmbus/mpq8646.c
> index 0000000000000..f8dfabef09df3 100644
> --- /dev/null
> +++ b/drivers/hwmon/pmbus/mpq8646.c
[ ... ]
> @@ -187,24 +187,24 @@ static inline struct mpq8646_priv *mpq8646_priv_from_client(struct i2c_client *c
>  static int mpq8646_raw_xfer_rword(struct i2c_client *client, u8 reg)
>  {
>  	u8 cmd = reg;
>  	__le16 data = 0;
>  	struct i2c_msg msg[] = {
>  		{
>  			.addr = client->addr,
>  			.flags = 0,
>  			.len = sizeof(cmd),
>  			.buf = &cmd,
>  		},
>  		{
>  			.addr = client->addr,
>  			.flags = I2C_M_RD,
>  			.len = sizeof(data),
>  			.buf = (u8 *)&data,
>  		},
>  	};
>  	int rc;
>  
>  	rc = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));

[Severity: High]
Can this cause memory corruption or a kernel panic?

I2C adapter drivers often use DMA for transfers. When CONFIG_VMAP_STACK is
enabled, the kernel stack is not guaranteed to be physically contiguous.
Passing stack-allocated buffers like cmd and data to DMA-capable APIs
like i2c_transfer() will cause dma_map_single() to map incorrect physical
memory.

Although this is triggered via debugfs, executing it on a DMA-capable I2C bus
could reliably crash or corrupt the system. Should these buffers be dynamically
allocated instead?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260724-mpq8646_v0-v5-0-5915b5ae9aa2@free.fr?part=3

  reply	other threads:[~2026-07-24  0:06 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 23:55 [PATCH v5 0/3] hwmon: pmbus: add MPS MPQ8646 support Vincent Jardin via B4 Relay
2026-07-23 23:55 ` [PATCH v5 1/3] hwmon: pmbus: event notification with alarms Vincent Jardin via B4 Relay
2026-07-24  0:10   ` sashiko-bot
2026-07-23 23:55 ` [PATCH v5 2/3] dt-bindings: hwmon: pmbus: add MPS MPQ8646 binding Vincent Jardin via B4 Relay
2026-07-24  0:02   ` sashiko-bot
2026-07-23 23:55 ` [PATCH v5 3/3] hwmon: pmbus: add MPQ8646 driver Vincent Jardin via B4 Relay
2026-07-24  0:06   ` sashiko-bot [this message]
2026-07-24  2:07     ` Guenter Roeck
2026-07-24  2:15   ` Guenter Roeck

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=20260724000643.E60C81F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=vjardin@free.fr \
    /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