Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit
@ 2026-11-08 17:26 Rupesh Majhi
  2026-11-08 17:29 ` sashiko-bot
  2026-11-09 18:30 ` Guenter Roeck
  0 siblings, 2 replies; 3+ messages in thread
From: Rupesh Majhi @ 2026-11-08 17:26 UTC (permalink / raw)
  To: Guenter Roeck, Johannes Cornelis Draaijer (datdenkikniet)
  Cc: linux-hwmon, linux-kernel, Rupesh Majhi

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit
  2026-11-08 17:26 [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit Rupesh Majhi
@ 2026-11-08 17:29 ` sashiko-bot
  2026-11-09 18:30 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-08 17:29 UTC (permalink / raw)
  To: Rupesh Majhi; +Cc: linux-hwmon

> 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>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261108172651.220121-1-zoone.rupert@gmail.com?part=1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit
  2026-11-08 17:26 [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit Rupesh Majhi
  2026-11-08 17:29 ` sashiko-bot
@ 2026-11-09 18:30 ` Guenter Roeck
  1 sibling, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2026-11-09 18:30 UTC (permalink / raw)
  To: Rupesh Majhi
  Cc: Johannes Cornelis Draaijer (datdenkikniet), linux-hwmon,
	linux-kernel

On Sun, Nov 08, 2026 at 07:26:51PM +0200, Rupesh Majhi wrote:
> 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>

Applied.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-09 18:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-08 17:26 [PATCH] hwmon: (aht10) Fix update_interval overflow on 64-bit Rupesh Majhi
2026-11-08 17:29 ` sashiko-bot
2026-11-09 18:30 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox