Quoting Peter Stuge <peter@xxxxxxxx>:
Pavel Roskin wrote:
Rate control algorithms are supposed to stop processing when they
encounter a rate with the index -1. Checking for rate->count not being
zero is not enough.
Maybe it's a good idea to use an unsigned variable and check for the
actual error condition when it can happen, instead of checking for an
"overflow" after the fact?
It's not my choice, it's written in include/net/mac80211.h:
* A value of -1 for @idx indicates an invalid rate and, if used
* in an array of retry rates, that no more rates should be tried.
I just want ath9k/rc to follow the documentation.
I believe the code in mac80211 uses both count=0 and idx=-1 to
indicate the end on the rate list, but in some cases, only idx=-1 is
used (my guess is that the list needs to be shortened). In any case,
mac80211 is must be correct because it expect rate control algorithms
to do what's documented in the header.
- if (!rate->count)
+ if (rate->idx < 0 || !rate->count)
break;
At the very least this could test for <= 0.
Index 0 may be valid. Other rate control algorithms only check for
negative values.
--
Regards,
Pavel Roskin
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html