All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Tom Verdonck" <tom.verdonck@inspiral.be>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH 3/3] hwmon: (sht4x) Fix jiffies wraparound in heater-ready check
Date: Fri, 25 Sep 2026 18:33:27 +0000	[thread overview]
Message-ID: <20260925183328.3BAC91F000FF@smtp.kernel.org> (raw)
In-Reply-To: <7b2087ccb963e097cf3f6333efaec0c46549003b.1790358356.git.tom.verdonck@inspiral.be>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] hwmon: (sht4x): torn read of heating_complete in heater_enable_show()
--

commit 90157fd25e4d294f6299c304227e07d23632d8e9
Author: Tom Verdonck <tom.verdonck@inspiral.be>

hwmon: (sht4x) Fix jiffies wraparound in heater-ready check

This commit changes the heating_complete field to a 64-bit jiffies
value to prevent wraparound issues after ~248.5 days on 32-bit systems.
It updates usages of this field to use get_jiffies_64() and
time_before64().

> diff --git a/drivers/hwmon/sht4x.c b/drivers/hwmon/sht4x.c
> index a97dda9e92dc5..da2b6130fca7e 100644
> --- a/drivers/hwmon/sht4x.c
> +++ b/drivers/hwmon/sht4x.c
[ ... ]
> @@ -237,7 +237,7 @@ static ssize_t heater_enable_show(struct device *dev,
>  {
>  	struct sht4x_data *data = dev_get_drvdata(dev);
>  
> -	return sysfs_emit(buf, "%u\n", time_before(jiffies, data->heating_complete));
> +	return sysfs_emit(buf, "%u\n", time_before64(get_jiffies_64(), data->heating_complete));
[Severity: Medium]
Since heating_complete is now a 64-bit field, does this read in
heater_enable_show() need to be protected by hwmon_lock?

If a user-space read to the heater_enable sysfs attribute runs concurrently
with a write via heater_enable_store(), it would race with the update to
data->heating_complete which is done under the lock.

Could this result in a torn read of data->heating_complete on 32-bit
architectures, causing an incorrect boolean value to be emitted?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1790358356.git.tom.verdonck@inspiral.be?part=3

  reply	other threads:[~2026-09-25 18:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25 18:23 [PATCH 0/3] hwmon: fix jiffies wraparound in one-shot ready checks Tom Verdonck
2026-09-25 18:23 ` [PATCH 1/3] hwmon: (tmp102) Fix jiffies wraparound in conversion-ready check Tom Verdonck
2026-09-25 18:29   ` sashiko-bot
2026-09-26  3:25   ` Guenter Roeck
2026-09-25 18:23 ` [PATCH 2/3] hwmon: (tmp108) " Tom Verdonck
2026-09-25 18:30   ` sashiko-bot
2026-09-26  3:26   ` Guenter Roeck
2026-09-25 18:23 ` [PATCH 3/3] hwmon: (sht4x) Fix jiffies wraparound in heater-ready check Tom Verdonck
2026-09-25 18:33   ` sashiko-bot [this message]
2026-09-26  3:27   ` Guenter Roeck
2026-09-28  6:22   ` [PATCH] hwmon: (sht4x) Fix torn read of heating_complete in heater_enable_show() Tom Verdonck

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=20260925183328.3BAC91F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=tom.verdonck@inspiral.be \
    /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.