@@ -82,9 +82,6 @@ static void wpas_mbo_np_chan_attr(struct wpa_supplicant *wpa_s,
{
size_t size = end - start + 4;
- if (start == end)
- return;
-
if (size + 2 > wpabuf_tailroom(mbo))
return;
@@ -109,9 +106,6 @@ static void wpas_mbo_np_chan_subelement(struct wpa_supplicant *wpa_s,
{
size_t size = end - start + 8;
- if (start == end)
- return;
-
if (size + 2 > wpabuf_tailroom(mbo))
return;
@@ -123,7 +117,6 @@ static void wpas_mbo_np_chan_subelement(struct wpa_supplicant *wpa_s,
static void wpas_mbo_np_chan_attrs(struct wpa_supplicant *wpa_s,
struct wpabuf *mbo, int subelement)
{
- u8 oper_class = 0, reason = 0, reason_detail = 0, preference = 0;
u8 i, start = 0;
if (!wpa_s->np_chan || !wpa_s->np_chan_num) {
@@ -132,26 +125,22 @@ static void wpas_mbo_np_chan_attrs(struct wpa_supplicant *wpa_s,
return;
}
- for (i = 0; i <= wpa_s->np_chan_num; i++) {
+ for (i = 1; i <= wpa_s->np_chan_num; i++) {
if (i == wpa_s->np_chan_num ||
- wpa_s->np_chan[i].oper_class != oper_class ||
- wpa_s->np_chan[i].reason != reason ||
- wpa_s->np_chan[i].reason_detail != reason_detail ||
- wpa_s->np_chan[i].preference != preference) {
+ wpa_s->np_chan[i].oper_class !=
+ wpa_s->np_chan[start].oper_class ||
+ wpa_s->np_chan[i].reason != wpa_s->np_chan[start].reason ||
+ wpa_s->np_chan[i].reason_detail !=
+ wpa_s->np_chan[start].reason_detail ||
+ wpa_s->np_chan[i].preference !=
+ wpa_s->np_chan[start].preference) {
if (subelement)
wpas_mbo_np_chan_subelement(wpa_s, mbo, start,
i);
else
wpas_mbo_np_chan_attr(wpa_s, mbo, start, i);
- if (i == wpa_s->np_chan_num)
- return;
-
start = i;
- oper_class = wpa_s->np_chan[i].oper_class;
- reason = wpa_s->np_chan[i].reason;
- reason_detail = wpa_s->np_chan[i].reason_detail;
- preference = wpa_s->np_chan[i].preference;
}
}
}