]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Use offsetof() instead of local implementation
authorJouni Malinen <j@w1.fi>
Tue, 23 Jun 2015 15:30:11 +0000 (18:30 +0300)
committerJouni Malinen <j@w1.fi>
Tue, 23 Jun 2015 15:30:11 +0000 (18:30 +0300)
The construction used here to figure out the offset of variable length
IEs in Probe Request frames was a bit odd looking and resulted in a
warning from a static analyzer, so replace it with more standard use of
offsetof().

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

index 16ffac4335194de46d6a18fb41ba06d50b3b4883..c9c3ec2dbbbfbc326ee2aed4eb77930ff82632ca 100644 (file)
@@ -2389,8 +2389,8 @@ p2p_reply_probe(struct p2p_data *p2p, const u8 *addr, const u8 *dst,
                return P2P_PREQ_NOT_PROCESSED;
        }
 
-       resp = NULL;
-       resp = wpabuf_put(buf, resp->u.probe_resp.variable - (u8 *) resp);
+       resp = wpabuf_put(buf, offsetof(struct ieee80211_mgmt,
+                                       u.probe_resp.variable));
 
        resp->frame_control = host_to_le16((WLAN_FC_TYPE_MGMT << 2) |
                                           (WLAN_FC_STYPE_PROBE_RESP << 4));