[PATCH] Fix coding oddities

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One typo and one peculiar update loop.

Signed-off-by: Jouke Witteveen <j.witteveen@xxxxxxxxx>
---

I came accross one typo, which had survived over four years, and one odd
loop in which a variable was updated at every iteration. If you dislike
how I refactored the loop, feel free to kick that part of the patch out.

Regards,
- Jouke

 wpa_supplicant/wpa_supplicant.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 185a8d50f..5865727c4 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1656,7 +1656,7 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
 		break;
 	case 4: /* Bits 32-39 */
 #ifdef CONFIG_INTERWORKING
-		if (wpa_s->drv_flags / WPA_DRIVER_FLAGS_QOS_MAPPING)
+		if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_QOS_MAPPING)
 			*pos |= 0x01; /* Bit 32 - QoS Map */
 #endif /* CONFIG_INTERWORKING */
 		break;
@@ -1691,7 +1691,7 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
 
 int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen)
 {
-	u8 *pos = buf;
+	u8 *pos = buf + 2;
 	u8 len = 10, i;
 
 	if (len < wpa_s->extended_capa_len)
@@ -1702,8 +1702,6 @@ int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen)
 		return -1;
 	}
 
-	*pos++ = WLAN_EID_EXT_CAPAB;
-	*pos++ = len;
 	for (i = 0; i < len; i++, pos++) {
 		wpas_ext_capab_byte(wpa_s, pos, i);
 
@@ -1713,10 +1711,10 @@ int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen)
 		}
 	}
 
-	while (len > 0 && buf[1 + len] == 0) {
+	while (len > 0 && buf[1 + len] == 0)
 		len--;
-		buf[1] = len;
-	}
+	buf[0] = WLAN_EID_EXT_CAPAB;
+	buf[1] = len;
 	if (len == 0)
 		return 0;
 
-- 
2.18.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux