Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Matti Vaittinen" <matti.vaittinen@linux.dev>
Cc: linux-hwmon@vger.kernel.org, robh@kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/9] hwmon: adm1275: Prevent reading uninitialized stack
Date: Fri, 26 Jun 2026 07:32:59 +0000	[thread overview]
Message-ID: <20260626073300.5ECEF1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <c8ad38e0cdb347261c6245de2b7965e747f28d22.1782458224.git.mazziesaccount@gmail.com>

> From: Matti Vaittinen <mazziesaccount@gmail.com>
> 
> While adding support for the ROHM BD127X0 hot-swap controllers, sashiko
> reported an error in device-name comparison, which can lead to reading
> uninitialized stack memory.
> 
> Quoting Sashiko:
> 
> This is a pre-existing issue, but I noticed that just before this block in
> adm1275_probe(), there might be an out-of-bounds stack read:
> 
>     ret = i2c_smbus_read_block_data(client, PMBUS_MFR_MODEL, block_buffer);
>     if (ret < 0) { ... }
>     for (mid = adm1275_id; mid->name[0]; mid++) {
>             if (!strncasecmp(mid->name, block_buffer, strlen(mid->name)))
>                     break;
>     }
> 
> Since i2c_smbus_read_block_data() reads up to 32 bytes into the
> uninitialized stack array block_buffer without appending a null
> terminator, strncasecmp() could read past the valid bytes returned in ret.
> 
> For example, if the device returns a shorter string like "adm12", checking
> it against "adm1275" up to the length of "adm1275" will continue reading
> into uninitialized stack bounds.
> 
> Prevent reading uninitialized memory by zeroing the stack array.
> 
> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1782458224.git.mazziesaccount@gmail.com?part=2


  reply	other threads:[~2026-06-26  7:33 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-26  7:21 [PATCH v2 0/9] Support ROHM BD127x0 hot-swap controllers Matti Vaittinen
2026-06-26  7:21 ` [PATCH v2 1/9] dt-bindings: adm1275: ROHM BD12780 hot-swap controller Matti Vaittinen
2026-06-26  7:31   ` sashiko-bot
2026-06-26 15:58   ` Conor Dooley
2026-06-26  7:22 ` [PATCH v2 2/9] hwmon: adm1275: Prevent reading uninitialized stack Matti Vaittinen
2026-06-26  7:32   ` sashiko-bot [this message]
2026-06-26  7:23 ` [PATCH v2 3/9] hwmon: adm1275: Detect coefficient overflow Matti Vaittinen
2026-06-26  7:35   ` sashiko-bot
2026-06-26  7:24 ` [PATCH v2 4/9] hwmon: adm1275: Support module auto-loading Matti Vaittinen
2026-06-26  7:31   ` sashiko-bot
2026-06-26  7:24 ` [PATCH v2 5/9] doc: Add ROHM BD12780 and BD12780A Matti Vaittinen
2026-06-26  7:36   ` sashiko-bot
2026-06-26  7:24 ` [PATCH v2 6/9] hwmon: adm1275: Support ROHM BD12780 Matti Vaittinen
2026-06-26  7:32   ` sashiko-bot
2026-06-26  7:25 ` [PATCH v2 7/9] dt-bindings: adm1275: ROHM BD12790 hot-swap controller Matti Vaittinen
2026-06-26  7:35   ` sashiko-bot
2026-06-26  7:25 ` [PATCH v2 8/9] doc: adm1275: Add ROHM BD12790 Matti Vaittinen
2026-06-26  7:32   ` sashiko-bot
2026-06-26  7:26 ` [PATCH v2 9/9] hwmon: adm1275: Support " Matti Vaittinen
2026-06-26  7:33   ` sashiko-bot
2026-06-26  7:49     ` Matti Vaittinen

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=20260626073300.5ECEF1F000E9@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=matti.vaittinen@linux.dev \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox