From: sashiko-bot@kernel.org
To: "Massinissa Ghoul" <massigh680@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (hih6130) Replace sprintf() with sysfs_emit()
Date: Sun, 06 Sep 2026 22:43:00 +0000 [thread overview]
Message-ID: <20260906224301.46ABE1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260907-hwmon-hih6130-sysfs-emit-v1-1-a1adb5245d0f@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver performs I2C transfers using a stack-allocated buffer, violating the DMA API and potentially causing memory corruption.
--
commit 8d977f465d31017a7624b9759009bb470f1a65cc
Author: Massinissa Ghoul <massigh680@gmail.com>
hwmon: (hih6130) Replace sprintf() with sysfs_emit()
Use sysfs_emit() instead of sprintf() in the sysfs show functions
hih6130_temperature_show() and hih6130_humidity_show() to use the
preferred kernel interface for writing to sysfs buffers.
> diff --git a/drivers/hwmon/hih6130.c b/drivers/hwmon/hih6130.c
> index 7984be1e706d5..6a79aab5d1285 100644
> --- a/drivers/hwmon/hih6130.c
> +++ b/drivers/hwmon/hih6130.c
> @@ -168,7 +168,7 @@ static ssize_t hih6130_temperature_show(struct device *dev,
> ret = hih6130_update_measurements(dev);
> if (ret < 0)
> return ret;
[Severity: High]
This isn't a bug introduced by this patch, but looking at the call to
hih6130_update_measurements(), is there a DMA-safety issue with how it
performs I2C transfers?
Inside hih6130_update_measurements(), a non-DMA-safe buffer is allocated
on the execution stack:
unsigned char tmp[4];
struct i2c_msg msgs[1] = {
{
.addr = client->addr,
.flags = I2C_M_RD,
.len = 4,
.buf = tmp,
}
};
This stack buffer is then passed directly into I2C functions that may
initiate a DMA operation:
ret = i2c_master_send(client, tmp, hih6130->write_length);
...
ret = i2c_transfer(client->adapter, msgs, 1);
Could this lead to memory corruption or kernel panics if the underlying
I2C controller driver attempts to DMA map this stack memory?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260907-hwmon-hih6130-sysfs-emit-v1-1-a1adb5245d0f@gmail.com?part=1
next prev parent reply other threads:[~2026-09-06 22:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 22:35 [PATCH] hwmon: (hih6130) Replace sprintf() with sysfs_emit() Massinissa Ghoul via B4 Relay
2026-09-06 22:35 ` Massinissa Ghoul
2026-09-06 22:43 ` sashiko-bot [this message]
2026-09-08 16:14 ` 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=20260906224301.46ABE1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=massigh680@gmail.com \
--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.