3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

wiphy: fix wiphy_contrain_freq_set skipping last channel

The loop iterating the frequency attributes list was not including
the entire channel set since it was stopping at i < band->freqs_len.
The freq_attrs array is allocated to include the last channel:

band->freq_attrs = l_new(struct band_freq_attrs, num_channels + 1);
band->freqs_len = num_channels;

So instead the for loop should use i <= band->freqs_len. (I also
changed this to start the loop at 1 since channel zero is invalid).
This commit is contained in:
James Prestwood 2023-09-19 09:59:22 -07:00 committed by Denis Kenzior
parent 9205308c47
commit 59033bc705

View File

@ -843,7 +843,7 @@ bool wiphy_constrain_freq_set(const struct wiphy *wiphy,
if (!band) if (!band)
continue; continue;
for (i = 0; i < band->freqs_len; i++) { for (i = 1; i <= band->freqs_len; i++) {
uint32_t freq; uint32_t freq;
if (!band->freq_attrs[i].supported) if (!band->freq_attrs[i].supported)