From: Zac Lanzon <lanzonza@gmail.com>
To: linux-hwmon@vger.kernel.org
Cc: Guenter Roeck <linux@roeck-us.net>,
Aleksa Savic <savicaleksa83@gmail.com>,
Edward Blair <edward.blair@gmail.com>,
sashiko-reviews@lists.linux.dev, Zac Lanzon <lanzonza@gmail.com>
Subject: Re: [PATCH 2/2] hwmon: (asus_rog_ryujin) Add pwm1_enable for the Ryujin III pump
Date: Sun, 27 Sep 2026 08:47:11 -0400 [thread overview]
Message-ID: <20260927124711.151260-1-lanzonza@gmail.com> (raw)
In-Reply-To: <20260927121932.72AAE1F000FF@smtp.kernel.org>
On Sun, Sep 27, 2026 at 12:19:31PM +0000, sashiko-bot@kernel.org wrote:
> > + now = jiffies;
> > + next = priv->source_changed + msecs_to_jiffies(RYUJIN_SOURCE_CHANGE_INTERVAL);
> > + if (time_before(now, next))
> > + msleep(jiffies_to_msecs(next - now));
>
> [Severity: Medium]
> Is there a risk of a massive unintended sleep here due to a jiffies
> wrap-around?
>
> On 32-bit systems, if the elapsed time since priv->source_changed exceeds
> 2^31 jiffies (for example, if there are no source changes for 24.8 days at
> HZ=1000), time_before() can wrap and return true. This would feed a very
> large wrapped value from next - now into msleep(), causing a thread hang
> when a write to the cooler duty attribute is attempted.
Right. v2 computes the elapsed time with an unsigned subtraction, so the
wait can never exceed RYUJIN_SOURCE_CHANGE_INTERVAL:
unsigned long interval = msecs_to_jiffies(RYUJIN_SOURCE_CHANGE_INTERVAL);
elapsed = jiffies - priv->source_changed;
if (elapsed < interval)
msleep(jiffies_to_msecs(interval - elapsed));
Patch 1 has no timing code and is unchanged. v2 follows tomorrow,
retested on the RYUJIN III 360.
Thanks,
Zac
prev parent reply other threads:[~2026-09-27 12:47 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-27 12:09 [PATCH 0/2] hwmon: (asus_rog_ryujin) Ryujin III pump control source Zac Lanzon
2026-09-27 12:09 ` [PATCH 1/2] hwmon: (asus_rog_ryujin) Fix pump control source on the Ryujin III Zac Lanzon
2026-09-27 12:16 ` sashiko-bot
2026-09-27 12:09 ` [PATCH 2/2] hwmon: (asus_rog_ryujin) Add pwm1_enable for the Ryujin III pump Zac Lanzon
2026-09-27 12:19 ` sashiko-bot
2026-09-27 12:47 ` Zac Lanzon [this message]
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=20260927124711.151260-1-lanzonza@gmail.com \
--to=lanzonza@gmail.com \
--cc=edward.blair@gmail.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=sashiko-reviews@lists.linux.dev \
--cc=savicaleksa83@gmail.com \
/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.