|
@@ -5239,11 +5239,11 @@ static int wpas_p2p_setup_freqs(struct wpa_supplicant *wpa_s, int freq,
|
|
|
if (!res && max_pref_freq > 0) {
|
|
|
*num_pref_freq = max_pref_freq;
|
|
|
i = 0;
|
|
|
- while ((!p2p_supported_freq(wpa_s->global->p2p,
|
|
|
+ while (i < *num_pref_freq &&
|
|
|
+ (!p2p_supported_freq(wpa_s->global->p2p,
|
|
|
pref_freq_list[i]) ||
|
|
|
wpas_p2p_disallowed_freq(wpa_s->global,
|
|
|
- pref_freq_list[i])) &&
|
|
|
- i < *num_pref_freq) {
|
|
|
+ pref_freq_list[i]))) {
|
|
|
wpa_printf(MSG_DEBUG,
|
|
|
"P2P: preferred_freq_list[%d]=%d is disallowed",
|
|
|
i, pref_freq_list[i]);
|