On 22/07/2025 10:54, Johannes Berg wrote:
On Mon, 2025-07-21 at 23:17 +0200, Antonio Quartulli wrote:
In ieee80211_latest_active_link_conn_timeout() we loop over all
sta->links in order to compute the timeout expiring last across
all links.
Such timeout is stored in `latest_timeout` which is used in the
time_after() comparison before having been initialized.
Should the for-loop terminate without ever setting `latest_timeout`
we would even return it in its uninitialized state.
It's really not plausible to have no links at all though.
I imagined so.
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]
Alternatively, we can just skip evaluating time_after() when
latest_timeout is 0.
Regards,
--
Antonio Quartulli
CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com