Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: limzhineng2@gmail.com, alexanderduyck@fb.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux@roeck-us.net, horms@kernel.org,
	mohsin.bashr@gmail.com, kernel-team@meta.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hwmon@vger.kernel.org, zinclim@meta.com
Subject: Re: [net-next,v2,3/6] eth: fbnic: cache hwmon sensor readings
Date: Fri, 4 Sep 2026 14:46:38 -0700	[thread overview]
Message-ID: <20260904144638.65481b26@kernel.org> (raw)
In-Reply-To: <178840584931.3394541.12792852899042444344@kernel.org>

On Thu, 03 Sep 2026 03:24:09 +0000 netdev-bot+sashiko@kernel.org 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

  reply	other threads:[~2026-09-04 21:46 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 21:22 [PATCH net-next v2 0/6] eth: fbnic: expand hwmon sensor support Zinc Lim
2026-08-31 21:22 ` [PATCH net-next v2 1/6] eth: fbnic: move sensor read logic out of fbnic_mac Zinc Lim
2026-08-31 21:22 ` [PATCH net-next v2 2/6] eth: fbnic: expose all hwmon attributes unconditionally as read-only Zinc Lim
2026-09-03  3:24   ` [net-next,v2,2/6] " netdev-bot+sashiko
2026-08-31 21:22 ` [PATCH net-next v2 3/6] eth: fbnic: cache hwmon sensor readings Zinc Lim
2026-09-03  3:24   ` [net-next,v2,3/6] " netdev-bot+sashiko
2026-09-04 21:46     ` Jakub Kicinski [this message]
2026-08-31 21:22 ` [PATCH net-next v2 4/6] eth: fbnic: report temperature and voltage thresholds via hwmon Zinc Lim
2026-09-03  3:24   ` [net-next,v2,4/6] " netdev-bot+sashiko
2026-08-31 21:22 ` [PATCH net-next v2 5/6] eth: fbnic: report temperature and voltage alarms " Zinc Lim
2026-09-03  3:24   ` [net-next,v2,5/6] " netdev-bot+sashiko
2026-08-31 21:22 ` [PATCH net-next v2 6/6] eth: fbnic: firmware notifies hwmon on sensor threshold events Zinc Lim
2026-09-03  3:24   ` [net-next,v2,6/6] " netdev-bot+sashiko

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=20260904144638.65481b26@kernel.org \
    --to=kuba@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kernel-team@meta.com \
    --cc=limzhineng2@gmail.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=zinclim@meta.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox