From: sashiko-bot@kernel.org
To: "Eugene Shalygin" <eugene.shalygin@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v2 1/1] hwmon: (asus-ec-sensors) add missed handle for ENOMEM
Date: Sun, 12 Jul 2026 13:12:21 +0000 [thread overview]
Message-ID: <20260712131222.5BF571F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260712130345.1256030-2-eugene.shalygin@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Spurious out-of-bank EC register reads due to incorrect filtering condition in asus_ec_block_read().
--
--- Patch [1]: [PATCH v2 1/1] hwmon: (asus-ec-sensors) add missed handle for ENOMEM ---
commit 6c544c8bc415253dbbfc446299b7748bcc5d2a83
Author: Eugene Shalygin <eugene.shalygin@gmail.com>
hwmon: (asus-ec-sensors) add missed handle for ENOMEM
Add missing return value check in the setup function.
> diff --git a/drivers/hwmon/asus-ec-sensors.c b/drivers/hwmon/asus-ec-sensors.c
> index 29a23484cbe7b..fc58b7eb413ee 100644
> --- a/drivers/hwmon/asus-ec-sensors.c
> +++ b/drivers/hwmon/asus-ec-sensors.c
[ ... ]
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential
issue in asus_ec_block_read() while reviewing this driver.
drivers/hwmon/asus-ec-sensors.c:asus_ec_block_read() {
[ ... ]
for (ibank = 0; ibank < ec->nr_banks; ibank++) {
if (bank != ec->banks[ibank]) {
bank = ec->banks[ibank];
[ ... ]
}
for (ireg = 0; ireg < ec->nr_registers; ireg++) {
reg_bank = register_bank(ec->registers[ireg]);
if (reg_bank < bank) {
continue;
}
ec_read(register_index(ec->registers[ireg]),
ec->read_buffer + ireg);
}
}
[ ... ]
}
Since the inner loop only skips registers from previously read banks
(reg_bank < bank), does this code mistakenly read registers intended
for future banks (where reg_bank > bank) while the hardware EC is still
switched to the current bank?
For example, if the hardware EC is switched to bank 0, would it incorrectly
read registers intended for bank 1, 2, etc., from the bank 0 hardware
interface?
Could reading arbitrary Embedded Controller registers without being in the
correct bank trigger clear-on-read side effects, disrupt state machines,
or lock up the EC?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260712130345.1256030-2-eugene.shalygin@gmail.com?part=1
next prev parent reply other threads:[~2026-07-12 13:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-12 13:00 [PATCH v2 0/1] hwmon: (asus-ec-sensors) add missed handle for ENOMEM Eugene Shalygin
2026-07-12 13:00 ` [PATCH v2 1/1] " Eugene Shalygin
2026-07-12 13:12 ` sashiko-bot [this message]
2026-07-12 14:42 ` Eugene Shalygin
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=20260712131222.5BF571F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eugene.shalygin@gmail.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