Re: [net-next,v2,3/6] eth: fbnic: cache hwmon sensor readings
From: Jakub Kicinski
Date: Fri Sep 04 2026 - 17:47:33 EST
On Thu, 03 Sep 2026 03:24:09 +0000 netdev-bot+sashiko@xxxxxxxxxx wrote:
> > @@ -25,26 +26,32 @@ static umode_t fbnic_hwmon_is_visible(const void *drvdata,
> > + if (*cached != FBNIC_SENSOR_NO_DATA &&
> > + time_is_after_eq_jiffies(cache->last_read)) {
> > + *val = *cached;
> > + return 0;
> > }
>
> [Severity: Medium]
> The cache validity test uses the wrong end of the jiffies helper
> family. time_is_after_eq_jiffies(a) expands to
> time_before_eq(jiffies, a), i.e. it is meant to be applied to a
> deadline that lies in the future, but cache->last_read is a timestamp
> in the past (it is assigned plain jiffies right after the TSENE
> response is parsed). It happens to give the intended "valid for the
> remainder of the current jiffy" behaviour only because
> time_before_eq() is a signed difference that goes negative one tick
> later.
This may be theoretical but it's also easy enough to fix.
There's no reason for us to use time_is_after() when
we want an exact comparison