Search Linux Wireless

Re: [PATCH] wifi: mac80211: fix unassigned variable access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 22/07/2025 11:02, Johannes Berg wrote:
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.

As discussed on IRC, also the caller of this function is wrongly assuming that returning 0 means "no timeout planned".

For this reason I'll send v2 where I will initialize latest_timeout to jiffies and I will re-arrange surrounding checks accordingly (caller included).


Regards,

--
Antonio Quartulli

CEO and Co-Founder
Mandelbit Srl
https://www.mandelbit.com





[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux