From aaa6b14984a038cf3b63172cb1f2231ab79d1471 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 23 Feb 2019 17:57:23 +0200 Subject: [PATCH] Avoid compiler warning about potentially unaligned pointer value (&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 --- src/ap/ctrl_iface_ap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index 3128aed6f..c69371511 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -1,6 +1,6 @@ /* * Control interface for shared AP commands - * Copyright (c) 2004-2014, Jouni Malinen + * Copyright (c) 2004-2019, Jouni Malinen * * 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;