mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-27 14:00:37 +01:00
wifi: fix find_freq() implementation
As we iterate over "self->num_freqs", we must not modify "freqs", otherwise, the second and subsequenty frequencies in self->freqs[i] cannot match. Fixes:dd8c546ff0('2007-12-27 Dan Williams <dcbw@redhat.com>') Fixes:ba8527ca58('wifi: preliminary nl80211 patch') (cherry picked from commit4f9f0587d5)
This commit is contained in:
parent
64c8bc24d6
commit
05766ad577
2 changed files with 9 additions and 9 deletions
|
|
@ -382,12 +382,12 @@ wifi_nl80211_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
|||
{
|
||||
NMWifiUtilsNl80211 *self = (NMWifiUtilsNl80211 *) data;
|
||||
int i;
|
||||
int j;
|
||||
|
||||
for (i = 0; i < self->num_freqs; i++) {
|
||||
while (*freqs) {
|
||||
if (self->freqs[i] == *freqs)
|
||||
return *freqs;
|
||||
freqs++;
|
||||
for (j = 0; freqs[j] != 0; j++) {
|
||||
if (self->freqs[i] == freqs[j])
|
||||
return freqs[j];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -252,13 +252,13 @@ static guint32
|
|||
wifi_wext_find_freq(NMWifiUtils *data, const guint32 *freqs)
|
||||
{
|
||||
NMWifiUtilsWext *wext = (NMWifiUtilsWext *) data;
|
||||
int i;
|
||||
guint i;
|
||||
guint j;
|
||||
|
||||
for (i = 0; i < wext->num_freqs; i++) {
|
||||
while (*freqs) {
|
||||
if (wext->freqs[i] == *freqs)
|
||||
return *freqs;
|
||||
freqs++;
|
||||
for (j = 0; freqs[j] != 0; j++) {
|
||||
if (wext->freqs[i] == freqs[j])
|
||||
return freqs[j];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue