From: Rupesh Majhi <zoone.rupert@gmail.com>
To: Guenter Roeck <linux@roeck-us.net>,
"Johannes Cornelis Draaijer (datdenkikniet)" <jcdra1@gmail.com>
Cc: linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org,
Rupesh Majhi <zoone.rupert@gmail.com>
Subject: [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit
Date: Sun, 8 Nov 2026 19:26:51 +0200 [thread overview]
Message-ID: <20261108172651.220121-1-zoone.rupert@gmail.com> (raw)
On 64-bit, update_interval writes are clamped to LONG_MAX ms, but
ms_to_ktime() overflows above 9223372036854 ms and the interval wraps.
LONG_MAX becomes -1 ms, so every read starts a new measurement and
update_interval reads back -1.
Clamp to INT_MAX like sht4x, so the limit is the same on all platforms.
Fixes: 8c78f0dee437 ("hwmon: Add AHT10 Temperature and Humidity Sensor Driver")
Signed-off-by: Rupesh Majhi <zoone.rupert@gmail.com>
---
Tested on x86_64 in QEMU with an emulated AHT20.
drivers/hwmon/aht10.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hwmon/aht10.c b/drivers/hwmon/aht10.c
index 6c263cb57766..c9ee50883f5d 100644
--- a/drivers/hwmon/aht10.c
+++ b/drivers/hwmon/aht10.c
@@ -222,7 +222,7 @@ static int aht10_read_values(struct aht10_data *data)
static ssize_t aht10_interval_write(struct aht10_data *data,
long val)
{
- data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, LONG_MAX));
+ data->min_poll_interval = ms_to_ktime(clamp_val(val, 2000, INT_MAX));
return 0;
}
base-commit: f4e680ffc2e50867c5b590e26a37f8801a31e486
--
2.43.0
reply other threads:[~2026-11-08 17:26 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261108172651.220121-1-zoone.rupert@gmail.com \
--to=zoone.rupert@gmail.com \
--cc=jcdra1@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
/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
all inboxes | Powered by JetHome®