]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Avoid compiler warning about potentially unaligned pointer value
authorJouni Malinen <j@w1.fi>
Sat, 23 Feb 2019 15:57:23 +0000 (17:57 +0200)
committerJouni Malinen <j@w1.fi>
Mon, 25 Feb 2019 17:48:49 +0000 (19:48 +0200)
(&mgmt->u.deauth.reason_code + 1) is not exactly clean and now that we
have the u8 variable[] member in the struct after this field, use that
directly to avoid clang compiler warning:
ctrl_iface_ap.c:454:18: error: taking address of packed member
      'reason_code' of class or structure 'ieee80211_mgmt::(anonymous
      union)::(anonymous)' may result in an unaligned pointer value
      [-Werror,-Waddress-of-packed-member]

Signed-off-by: Jouni Malinen <j@w1.fi>
src/ap/ctrl_iface_ap.c

index 3128aed6feb4e820db11a7b79c75572cae09b115..c6937151163447c3bfd7d80dce366d0b05e3315b 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Control interface for shared AP commands
- * Copyright (c) 2004-2014, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -451,11 +451,11 @@ static int p2p_manager_disconnect(struct hostapd_data *hapd, u16 stype,
        if (stype == WLAN_FC_STYPE_DEAUTH) {
                mgmt->u.deauth.reason_code =
                        host_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
-               pos = (u8 *) (&mgmt->u.deauth.reason_code + 1);
+               pos = mgmt->u.deauth.variable;
        } else {
                mgmt->u.disassoc.reason_code =
                        host_to_le16(WLAN_REASON_PREV_AUTH_NOT_VALID);
-               pos = (u8 *) (&mgmt->u.disassoc.reason_code + 1);
+               pos = mgmt->u.disassoc.variable;
        }
 
        *pos++ = WLAN_EID_VENDOR_SPECIFIC;