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

scan: Fix logic error in frequency validation

The intent here was to validate that the frequency is a multiple of 5
and lies in a certain range.  Somehow the channel was checked for being
a multiple of 5 instead.
This commit is contained in:
Denis Kenzior 2019-10-17 18:00:33 -05:00
parent 9ec50c910b
commit f878ec275d

View File

@ -1523,7 +1523,7 @@ uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band)
} }
if (freq >= 5005 && freq < 5900) { if (freq >= 5005 && freq < 5900) {
if (channel % 5) if (freq % 5)
return 0; return 0;
channel = (freq - 5000) / 5; channel = (freq - 5000) / 5;
@ -1535,7 +1535,7 @@ uint8_t scan_freq_to_channel(uint32_t freq, enum scan_band *out_band)
} }
if (freq >= 4905 && freq < 5000) { if (freq >= 4905 && freq < 5000) {
if (channel % 5) if (freq % 5)
return 0; return 0;
channel = (freq - 4000) / 5; channel = (freq - 4000) / 5;