linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Antonio Quartulli <antonio@mandelbit.com>,
	linux-wireless@vger.kernel.org
Cc: Maharaja Kennadyrajan <maharaja.kennadyrajan@oss.qualcomm.com>
Subject: Re: [PATCH] wifi: mac80211: fix unassigned variable access
Date: Tue, 22 Jul 2025 11:02:21 +0200	[thread overview]
Message-ID: <1db07eb608ee4345c70fe135dfbe6fc19e17cdf2.camel@sipsolutions.net> (raw)
In-Reply-To: <2e3aa500-989b-4acf-b6f8-9ee200e67cca@mandelbit.com> (sfid-20250722_110026_114297_7F9F7184)

On Tue, 2025-07-22 at 11:00 +0200, Antonio Quartulli wrote:
> > So I think if anything we should worry about the
> > 
> >                  if (time_is_after_jiffies(timeout) &&
> >                      time_after(timeout, latest_timeout))
> >                          latest_timeout = timeout;
> > 
> > comparison, but for that just unconditionally setting it to 0 is really
> > the wrong thing to do, since it means you compare to an arbitrary time
> > zero here?
> 
> We are looking for the maximum timeout, so using 0 (minimum possible 
> value) as base line should be what we want, no?
> 
> [note: I am assuming 0 is not a possible timeout value]

That assumption is wrong, in fact jiffies starts at a slightly negative
value (about 5 minutes?) so that a few minutes after boot the time goes
to the perfectly valid value zero. And on HZ=1000 32-bit systems, this
situation of course reappears every ~49.7 days.
> 
> Alternatively, we can just skip evaluating time_after() when 
> latest_timeout is 0.

But then we'd also have to set it to 1 if a timeout value is actually 0.

johannes

  reply	other threads:[~2025-07-22  9:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 21:17 [PATCH] wifi: mac80211: fix unassigned variable access Antonio Quartulli
2025-07-22  8:54 ` Johannes Berg
2025-07-22  9:00   ` Antonio Quartulli
2025-07-22  9:02     ` Johannes Berg [this message]
2025-07-22  9:34       ` Antonio Quartulli

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=1db07eb608ee4345c70fe135dfbe6fc19e17cdf2.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=antonio@mandelbit.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=maharaja.kennadyrajan@oss.qualcomm.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;
as well as URLs for NNTP newsgroup(s).