From owner-svn-src-head@FreeBSD.ORG Mon May 25 19:18:23 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id BB30A3D4; Mon, 25 May 2015 19:18:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A748EB3E; Mon, 25 May 2015 19:18:23 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4PJINJP004596; Mon, 25 May 2015 19:18:23 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4PJIGnk004558; Mon, 25 May 2015 19:18:16 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201505251918.t4PJIGnk004558@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Mon, 25 May 2015 19:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r283538 - head/sys/net80211 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 May 2015 19:18:23 -0000 Author: adrian Date: Mon May 25 19:18:16 2015 New Revision: 283538 URL: https://svnweb.freebsd.org/changeset/base/283538 Log: Convert malloc/free back to #define's, as part of OS portability work. DragonflyBSD uses the FreeBSD wireless stack and drivers. Their malloc() API is named differently, so they don't have userland/kernel symbol clashes like we do (think libuinet.) So, to make it easier for them and to port to other BSDs/other operating systems, start hiding the malloc specific bits behind defines in ieee80211_freebsd.h. DragonflyBSD can now put these portability defines in their local ieee80211_dragonflybsd.h. This should be a great big no-op for everyone running wifi. TODO: * kill M_WAITOK - some platforms just don't want you to use it * .. and/or handle it returning NULL rather than waiting forever. * MALLOC_DEFINE() ? * Migrate the well-known malloc names (eg M_TEMP) to net80211 namespace defines. Modified: head/sys/net80211/ieee80211_acl.c head/sys/net80211/ieee80211_amrr.c head/sys/net80211/ieee80211_crypto_ccmp.c head/sys/net80211/ieee80211_crypto_tkip.c head/sys/net80211/ieee80211_crypto_wep.c head/sys/net80211/ieee80211_freebsd.c head/sys/net80211/ieee80211_freebsd.h head/sys/net80211/ieee80211_hostap.c head/sys/net80211/ieee80211_hwmp.c head/sys/net80211/ieee80211_input.c head/sys/net80211/ieee80211_ioctl.c head/sys/net80211/ieee80211_mesh.c head/sys/net80211/ieee80211_node.c head/sys/net80211/ieee80211_output.c head/sys/net80211/ieee80211_power.c head/sys/net80211/ieee80211_proto.c head/sys/net80211/ieee80211_ratectl_none.c head/sys/net80211/ieee80211_regdomain.c head/sys/net80211/ieee80211_rssadapt.c head/sys/net80211/ieee80211_scan_sta.c head/sys/net80211/ieee80211_scan_sw.c head/sys/net80211/ieee80211_sta.c head/sys/net80211/ieee80211_superg.c head/sys/net80211/ieee80211_tdma.c Modified: head/sys/net80211/ieee80211_acl.c ============================================================================== --- head/sys/net80211/ieee80211_acl.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_acl.c Mon May 25 19:18:16 2015 (r283538) @@ -99,8 +99,8 @@ acl_attach(struct ieee80211vap *vap) { struct aclstate *as; - as = (struct aclstate *) malloc(sizeof(struct aclstate), - M_80211_ACL, M_NOWAIT | M_ZERO); + as = (struct aclstate *) IEEE80211_MALLOC(sizeof(struct aclstate), + M_80211_ACL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (as == NULL) return 0; ACL_LOCK_INIT(as, "acl"); @@ -123,7 +123,7 @@ acl_detach(struct ieee80211vap *vap) acl_free_all(vap); vap->iv_as = NULL; ACL_LOCK_DESTROY(as); - free(as, M_80211_ACL); + IEEE80211_FREE(as, M_80211_ACL); } static __inline struct acl * @@ -147,7 +147,7 @@ _acl_free(struct aclstate *as, struct ac TAILQ_REMOVE(&as->as_list, acl, acl_list); LIST_REMOVE(acl, acl_hash); - free(acl, M_80211_ACL); + IEEE80211_FREE(acl, M_80211_ACL); as->as_nacls--; } @@ -175,7 +175,8 @@ acl_add(struct ieee80211vap *vap, const struct acl *acl, *new; int hash; - new = (struct acl *) malloc(sizeof(struct acl), M_80211_ACL, M_NOWAIT | M_ZERO); + new = (struct acl *) IEEE80211_MALLOC(sizeof(struct acl), + M_80211_ACL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (new == NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: add %s failed, no memory\n", ether_sprintf(mac)); @@ -188,7 +189,7 @@ acl_add(struct ieee80211vap *vap, const LIST_FOREACH(acl, &as->as_hash[hash], acl_hash) { if (IEEE80211_ADDR_EQ(acl->acl_macaddr, mac)) { ACL_UNLOCK(as); - free(new, M_80211_ACL); + IEEE80211_FREE(new, M_80211_ACL); IEEE80211_DPRINTF(vap, IEEE80211_MSG_ACL, "ACL: add %s failed, already present\n", ether_sprintf(mac)); @@ -302,8 +303,8 @@ acl_getioctl(struct ieee80211vap *vap, s ireq->i_len = space; /* return required space */ return 0; /* NB: must not error */ } - ap = (struct ieee80211req_maclist *) malloc(space, - M_TEMP, M_NOWAIT); + ap = (struct ieee80211req_maclist *) IEEE80211_MALLOC(space, + M_TEMP, IEEE80211_M_NOWAIT); if (ap == NULL) return ENOMEM; i = 0; @@ -318,7 +319,7 @@ acl_getioctl(struct ieee80211vap *vap, s ireq->i_len = space; } else error = copyout(ap, ireq->i_data, ireq->i_len); - free(ap, M_TEMP); + IEEE80211_FREE(ap, M_TEMP); return error; } return EINVAL; Modified: head/sys/net80211/ieee80211_amrr.c ============================================================================== --- head/sys/net80211/ieee80211_amrr.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_amrr.c Mon May 25 19:18:16 2015 (r283538) @@ -113,8 +113,8 @@ amrr_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s called multiple times", __func__)); - amrr = vap->iv_rs = malloc(sizeof(struct ieee80211_amrr), - M_80211_RATECTL, M_NOWAIT|M_ZERO); + amrr = vap->iv_rs = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr), + M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (amrr == NULL) { if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n"); return; @@ -128,7 +128,7 @@ amrr_init(struct ieee80211vap *vap) static void amrr_deinit(struct ieee80211vap *vap) { - free(vap->iv_rs, M_80211_RATECTL); + IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); } /* @@ -160,8 +160,8 @@ amrr_node_init(struct ieee80211_node *ni uint8_t rate; if (ni->ni_rctls == NULL) { - ni->ni_rctls = amn = malloc(sizeof(struct ieee80211_amrr_node), - M_80211_RATECTL, M_NOWAIT|M_ZERO); + ni->ni_rctls = amn = IEEE80211_MALLOC(sizeof(struct ieee80211_amrr_node), + M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (amn == NULL) { if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl " "structure\n"); @@ -225,7 +225,7 @@ amrr_node_init(struct ieee80211_node *ni static void amrr_node_deinit(struct ieee80211_node *ni) { - free(ni->ni_rctls, M_80211_RATECTL); + IEEE80211_FREE(ni->ni_rctls, M_80211_RATECTL); } static int Modified: head/sys/net80211/ieee80211_crypto_ccmp.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_ccmp.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_crypto_ccmp.c Mon May 25 19:18:16 2015 (r283538) @@ -96,8 +96,8 @@ ccmp_attach(struct ieee80211vap *vap, st { struct ccmp_ctx *ctx; - ctx = (struct ccmp_ctx *) malloc(sizeof(struct ccmp_ctx), - M_80211_CRYPTO, M_NOWAIT | M_ZERO); + ctx = (struct ccmp_ctx *) IEEE80211_MALLOC(sizeof(struct ccmp_ctx), + M_80211_CRYPTO, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ctx == NULL) { vap->iv_stats.is_crypto_nomem++; return NULL; @@ -113,7 +113,7 @@ ccmp_detach(struct ieee80211_key *k) { struct ccmp_ctx *ctx = k->wk_private; - free(ctx, M_80211_CRYPTO); + IEEE80211_FREE(ctx, M_80211_CRYPTO); KASSERT(nrefs > 0, ("imbalanced attach/detach")); nrefs--; /* NB: we assume caller locking */ } Modified: head/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_tkip.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_crypto_tkip.c Mon May 25 19:18:16 2015 (r283538) @@ -109,8 +109,8 @@ tkip_attach(struct ieee80211vap *vap, st { struct tkip_ctx *ctx; - ctx = (struct tkip_ctx *) malloc(sizeof(struct tkip_ctx), - M_80211_CRYPTO, M_NOWAIT | M_ZERO); + ctx = (struct tkip_ctx *) IEEE80211_MALLOC(sizeof(struct tkip_ctx), + M_80211_CRYPTO, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ctx == NULL) { vap->iv_stats.is_crypto_nomem++; return NULL; @@ -126,7 +126,7 @@ tkip_detach(struct ieee80211_key *k) { struct tkip_ctx *ctx = k->wk_private; - free(ctx, M_80211_CRYPTO); + IEEE80211_FREE(ctx, M_80211_CRYPTO); KASSERT(nrefs > 0, ("imbalanced attach/detach")); nrefs--; /* NB: we assume caller locking */ } Modified: head/sys/net80211/ieee80211_crypto_wep.c ============================================================================== --- head/sys/net80211/ieee80211_crypto_wep.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_crypto_wep.c Mon May 25 19:18:16 2015 (r283538) @@ -87,8 +87,8 @@ wep_attach(struct ieee80211vap *vap, str { struct wep_ctx *ctx; - ctx = (struct wep_ctx *) malloc(sizeof(struct wep_ctx), - M_80211_CRYPTO, M_NOWAIT | M_ZERO); + ctx = (struct wep_ctx *) IEEE80211_MALLOC(sizeof(struct wep_ctx), + M_80211_CRYPTO, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ctx == NULL) { vap->iv_stats.is_crypto_nomem++; return NULL; @@ -106,7 +106,7 @@ wep_detach(struct ieee80211_key *k) { struct wep_ctx *ctx = k->wk_private; - free(ctx, M_80211_CRYPTO); + IEEE80211_FREE(ctx, M_80211_CRYPTO); KASSERT(nrefs > 0, ("imbalanced attach/detach")); nrefs--; /* NB: we assume caller locking */ } Modified: head/sys/net80211/ieee80211_freebsd.c ============================================================================== --- head/sys/net80211/ieee80211_freebsd.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_freebsd.c Mon May 25 19:18:16 2015 (r283538) @@ -82,7 +82,8 @@ wlan_alloc(u_char type, struct ifnet *if { struct ieee80211com *ic; - ic = malloc(sizeof(struct ieee80211com), M_80211_COM, M_WAITOK|M_ZERO); + ic = IEEE80211_MALLOC(sizeof(struct ieee80211com), M_80211_COM, + IEEE80211_M_WAITOK | IEEE80211_M_ZERO); ic->ic_ifp = ifp; return (ic); @@ -91,7 +92,7 @@ wlan_alloc(u_char type, struct ifnet *if static void wlan_free(void *ic, u_char type) { - free(ic, M_80211_COM); + IEEE80211_FREE(ic, M_80211_COM); } static int @@ -244,8 +245,8 @@ ieee80211_sysctl_vattach(struct ieee8021 struct sysctl_oid *oid; char num[14]; /* sufficient for 32 bits */ - ctx = (struct sysctl_ctx_list *) malloc(sizeof(struct sysctl_ctx_list), - M_DEVBUF, M_NOWAIT | M_ZERO); + ctx = (struct sysctl_ctx_list *) IEEE80211_MALLOC(sizeof(struct sysctl_ctx_list), + M_DEVBUF, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ctx == NULL) { if_printf(ifp, "%s: cannot allocate sysctl context!\n", __func__); @@ -320,7 +321,7 @@ ieee80211_sysctl_vdetach(struct ieee8021 if (vap->iv_sysctl != NULL) { sysctl_ctx_free(vap->iv_sysctl); - free(vap->iv_sysctl, M_DEVBUF); + IEEE80211_FREE(vap->iv_sysctl, M_DEVBUF); vap->iv_sysctl = NULL; } } Modified: head/sys/net80211/ieee80211_freebsd.h ============================================================================== --- head/sys/net80211/ieee80211_freebsd.h Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_freebsd.h Mon May 25 19:18:16 2015 (r283538) @@ -596,4 +596,19 @@ struct ieee80211_bpf_params { uint8_t ibp_try3; /* series 4 try count */ uint8_t ibp_rate3; /* series 4 IEEE tx rate */ }; + +/* + * Malloc API. Other BSD operating systems have slightly + * different malloc/free namings (eg DragonflyBSD.) + */ +#define IEEE80211_MALLOC malloc +#define IEEE80211_FREE free + +/* XXX TODO: get rid of WAITOK, fix all the users of it? */ +#define IEEE80211_M_NOWAIT M_NOWAIT +#define IEEE80211_M_WAITOK M_WAITOK +#define IEEE80211_M_ZERO M_ZERO + +/* XXX TODO: the type fields */ + #endif /* _NET80211_IEEE80211_FREEBSD_H_ */ Modified: head/sys/net80211/ieee80211_hostap.c ============================================================================== --- head/sys/net80211/ieee80211_hostap.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_hostap.c Mon May 25 19:18:16 2015 (r283538) @@ -939,7 +939,7 @@ hostap_auth_open(struct ieee80211_node * * open auth is attempted. */ if (ni->ni_challenge != NULL) { - free(ni->ni_challenge, M_80211_NODE); + IEEE80211_FREE(ni->ni_challenge, M_80211_NODE); ni->ni_challenge = NULL; } /* XXX hack to workaround calling convention */ @@ -2042,7 +2042,7 @@ hostap_recv_mgmt(struct ieee80211_node * return; /* discard challenge after association */ if (ni->ni_challenge != NULL) { - free(ni->ni_challenge, M_80211_NODE); + IEEE80211_FREE(ni->ni_challenge, M_80211_NODE); ni->ni_challenge = NULL; } /* NB: 802.11 spec says to ignore station's privacy bit */ Modified: head/sys/net80211/ieee80211_hwmp.c ============================================================================== --- head/sys/net80211/ieee80211_hwmp.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_hwmp.c Mon May 25 19:18:16 2015 (r283538) @@ -268,8 +268,8 @@ hwmp_vattach(struct ieee80211vap *vap) KASSERT(vap->iv_opmode == IEEE80211_M_MBSS, ("not a mesh vap, opmode %d", vap->iv_opmode)); - hs = malloc(sizeof(struct ieee80211_hwmp_state), M_80211_VAP, - M_NOWAIT | M_ZERO); + hs = IEEE80211_MALLOC(sizeof(struct ieee80211_hwmp_state), M_80211_VAP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (hs == NULL) { printf("%s: couldn't alloc HWMP state\n", __func__); return; @@ -285,7 +285,7 @@ hwmp_vdetach(struct ieee80211vap *vap) struct ieee80211_hwmp_state *hs = vap->iv_hwmp; callout_drain(&hs->hs_roottimer); - free(vap->iv_hwmp, M_80211_VAP); + IEEE80211_FREE(vap->iv_hwmp, M_80211_VAP); vap->iv_hwmp = NULL; } @@ -429,9 +429,10 @@ hwmp_recv_action_meshpath(struct ieee802 vap->iv_stats.is_rx_mgtdiscard++; break; } - preq = malloc(sizeof(*preq) + + preq = IEEE80211_MALLOC(sizeof(*preq) + (ndest - 1) * sizeof(*preq->preq_targets), - M_80211_MESH_PREQ, M_NOWAIT | M_ZERO); + M_80211_MESH_PREQ, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); KASSERT(preq != NULL, ("preq == NULL")); preq->preq_ie = *iefrm_t++; @@ -464,7 +465,7 @@ hwmp_recv_action_meshpath(struct ieee802 } hwmp_recv_preq(vap, ni, wh, preq); - free(preq, M_80211_MESH_PREQ); + IEEE80211_FREE(preq, M_80211_MESH_PREQ); found++; break; } @@ -476,8 +477,9 @@ hwmp_recv_action_meshpath(struct ieee802 vap->iv_stats.is_rx_mgtdiscard++; break; } - prep = malloc(sizeof(*prep), - M_80211_MESH_PREP, M_NOWAIT | M_ZERO); + prep = IEEE80211_MALLOC(sizeof(*prep), + M_80211_MESH_PREP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); KASSERT(prep != NULL, ("prep == NULL")); prep->prep_ie = *iefrm_t++; @@ -501,7 +503,7 @@ hwmp_recv_action_meshpath(struct ieee802 prep->prep_origseq = LE_READ_4(iefrm_t); iefrm_t += 4; hwmp_recv_prep(vap, ni, wh, prep); - free(prep, M_80211_MESH_PREP); + IEEE80211_FREE(prep, M_80211_MESH_PREP); found++; break; } @@ -515,9 +517,10 @@ hwmp_recv_action_meshpath(struct ieee802 vap->iv_stats.is_rx_mgtdiscard++; break; } - perr = malloc(sizeof(*perr) + + perr = IEEE80211_MALLOC(sizeof(*perr) + (ndest - 1) * sizeof(*perr->perr_dests), - M_80211_MESH_PERR, M_NOWAIT | M_ZERO); + M_80211_MESH_PERR, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); KASSERT(perr != NULL, ("perr == NULL")); perr->perr_ie = *iefrm_t++; @@ -546,7 +549,7 @@ hwmp_recv_action_meshpath(struct ieee802 } hwmp_recv_perr(vap, ni, wh, perr); - free(perr, M_80211_MESH_PERR); + IEEE80211_FREE(perr, M_80211_MESH_PERR); found++; break; } @@ -1556,8 +1559,8 @@ hwmp_recv_perr(struct ieee80211vap *vap, */ if (ms->ms_flags & IEEE80211_MESHFLAGS_FWD) { forward = 1; - pperr = malloc(sizeof(*perr) + 31*sizeof(*perr->perr_dests), - M_80211_MESH_PERR, M_NOWAIT); /* XXX: magic number, 32 err dests */ + pperr = IEEE80211_MALLOC(sizeof(*perr) + 31*sizeof(*perr->perr_dests), + M_80211_MESH_PERR, IEEE80211_M_NOWAIT); /* XXX: magic number, 32 err dests */ } /* @@ -1632,7 +1635,7 @@ hwmp_recv_perr(struct ieee80211vap *vap, } done: if (pperr != NULL) - free(pperr, M_80211_MESH_PERR); + IEEE80211_FREE(pperr, M_80211_MESH_PERR); } #undef PERR_DFLAGS #undef PERR_DADDR Modified: head/sys/net80211/ieee80211_input.c ============================================================================== --- head/sys/net80211/ieee80211_input.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_input.c Mon May 25 19:18:16 2015 (r283538) @@ -449,8 +449,9 @@ int ieee80211_alloc_challenge(struct ieee80211_node *ni) { if (ni->ni_challenge == NULL) - ni->ni_challenge = (uint32_t *) malloc(IEEE80211_CHALLENGE_LEN, - M_80211_NODE, M_NOWAIT); + ni->ni_challenge = (uint32_t *) + IEEE80211_MALLOC(IEEE80211_CHALLENGE_LEN, + M_80211_NODE, IEEE80211_M_NOWAIT); if (ni->ni_challenge == NULL) { IEEE80211_NOTE(ni->ni_vap, IEEE80211_MSG_DEBUG | IEEE80211_MSG_AUTH, ni, Modified: head/sys/net80211/ieee80211_ioctl.c ============================================================================== --- head/sys/net80211/ieee80211_ioctl.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_ioctl.c Mon May 25 19:18:16 2015 (r283538) @@ -323,14 +323,15 @@ ieee80211_ioctl_getscanresults(struct ie space = req.space; /* XXX M_WAITOK after driver lock released */ - p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO); + p = IEEE80211_MALLOC(space, M_TEMP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (p == NULL) return ENOMEM; req.sr = p; ieee80211_scan_iterate(vap, get_scan_result, &req); ireq->i_len = space - req.space; error = copyout(p, ireq->i_data, ireq->i_len); - free(p, M_TEMP); + IEEE80211_FREE(p, M_TEMP); } else ireq->i_len = 0; @@ -473,7 +474,8 @@ getstainfo_common(struct ieee80211vap *v if (req.space > 0) { space = req.space; /* XXX M_WAITOK after driver lock released */ - p = malloc(space, M_TEMP, M_NOWAIT | M_ZERO); + p = IEEE80211_MALLOC(space, M_TEMP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (p == NULL) { error = ENOMEM; goto bad; @@ -485,7 +487,7 @@ getstainfo_common(struct ieee80211vap *v get_sta_info(&req, ni); ireq->i_len = space - req.space; error = copyout(p, (uint8_t *) ireq->i_data+off, ireq->i_len); - free(p, M_TEMP); + IEEE80211_FREE(p, M_TEMP); } else ireq->i_len = 0; bad: @@ -697,7 +699,8 @@ ieee80211_ioctl_getdevcaps(struct ieee80 if (maxchans > 2048) maxchans = 2048; dc = (struct ieee80211_devcaps_req *) - malloc(IEEE80211_DEVCAPS_SIZE(maxchans), M_TEMP, M_NOWAIT | M_ZERO); + IEEE80211_MALLOC(IEEE80211_DEVCAPS_SIZE(maxchans), M_TEMP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (dc == NULL) return ENOMEM; dc->dc_drivercaps = ic->ic_caps; @@ -709,7 +712,7 @@ ieee80211_ioctl_getdevcaps(struct ieee80 ("nchans %d maxchans %d", ci->ic_nchans, maxchans)); ieee80211_sort_channels(ci->ic_chans, ci->ic_nchans); error = copyout(dc, ireq->i_data, IEEE80211_DEVCAPS_SPACE(dc)); - free(dc, M_TEMP); + IEEE80211_FREE(dc, M_TEMP); return error; } @@ -1666,13 +1669,13 @@ ieee80211_ioctl_setchanlist(struct ieee8 if (ireq->i_len > sizeof(ic->ic_chan_active)) ireq->i_len = sizeof(ic->ic_chan_active); - list = malloc(ireq->i_len + IEEE80211_CHAN_BYTES, M_TEMP, - M_NOWAIT | M_ZERO); + list = IEEE80211_MALLOC(ireq->i_len + IEEE80211_CHAN_BYTES, M_TEMP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (list == NULL) return ENOMEM; error = copyin(ireq->i_data, list, ireq->i_len); if (error) { - free(list, M_TEMP); + IEEE80211_FREE(list, M_TEMP); return error; } nchan = 0; @@ -1691,7 +1694,7 @@ ieee80211_ioctl_setchanlist(struct ieee8 } } if (nchan == 0) { - free(list, M_TEMP); + IEEE80211_FREE(list, M_TEMP); return EINVAL; } if (ic->ic_bsschan != IEEE80211_CHAN_ANYC && /* XXX */ @@ -1699,7 +1702,7 @@ ieee80211_ioctl_setchanlist(struct ieee8 ic->ic_bsschan = IEEE80211_CHAN_ANYC; memcpy(ic->ic_chan_active, chanlist, IEEE80211_CHAN_BYTES); ieee80211_scan_flush(vap); - free(list, M_TEMP); + IEEE80211_FREE(list, M_TEMP); return ENETRESET; } @@ -2112,7 +2115,8 @@ ieee80211_ioctl_setregdomain(struct ieee return EINVAL; } reg = (struct ieee80211_regdomain_req *) - malloc(IEEE80211_REGDOMAIN_SIZE(nchans), M_TEMP, M_NOWAIT); + IEEE80211_MALLOC(IEEE80211_REGDOMAIN_SIZE(nchans), M_TEMP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (reg == NULL) { IEEE80211_DPRINTF(vap, IEEE80211_MSG_IOCTL, "%s: no memory, nchans %d\n", __func__, nchans); @@ -2129,7 +2133,7 @@ ieee80211_ioctl_setregdomain(struct ieee } else error = ieee80211_setregdomain(vap, reg); } - free(reg, M_TEMP); + IEEE80211_FREE(reg, M_TEMP); return (error == 0 ? ENETRESET : error); } @@ -2246,7 +2250,7 @@ setappie(struct ieee80211_appie **aie, c if (ireq->i_len == 0) { /* delete any existing ie */ if (app != NULL) { *aie = NULL; /* XXX racey */ - free(app, M_80211_NODE_IE); + IEEE80211_FREE(app, M_80211_NODE_IE); } return 0; } @@ -2260,20 +2264,21 @@ setappie(struct ieee80211_appie **aie, c * * XXX bad bad bad */ - napp = (struct ieee80211_appie *) malloc( - sizeof(struct ieee80211_appie) + ireq->i_len, M_80211_NODE_IE, M_NOWAIT); + napp = (struct ieee80211_appie *) IEEE80211_MALLOC( + sizeof(struct ieee80211_appie) + ireq->i_len, M_80211_NODE_IE, + IEEE80211_M_NOWAIT); if (napp == NULL) return ENOMEM; /* XXX holding ic lock */ error = copyin(ireq->i_data, napp->ie_data, ireq->i_len); if (error) { - free(napp, M_80211_NODE_IE); + IEEE80211_FREE(napp, M_80211_NODE_IE); return error; } napp->ie_len = ireq->i_len; *aie = napp; if (app != NULL) - free(app, M_80211_NODE_IE); + IEEE80211_FREE(app, M_80211_NODE_IE); return 0; } Modified: head/sys/net80211/ieee80211_mesh.c ============================================================================== --- head/sys/net80211/ieee80211_mesh.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_mesh.c Mon May 25 19:18:16 2015 (r283538) @@ -211,8 +211,9 @@ mesh_rt_add_locked(struct ieee80211vap * MESH_RT_LOCK_ASSERT(ms); - rt = malloc(ALIGN(sizeof(struct ieee80211_mesh_route)) + - ms->ms_ppath->mpp_privlen, M_80211_MESH_RT, M_NOWAIT | M_ZERO); + rt = IEEE80211_MALLOC(ALIGN(sizeof(struct ieee80211_mesh_route)) + + ms->ms_ppath->mpp_privlen, M_80211_MESH_RT, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (rt != NULL) { rt->rt_vap = vap; IEEE80211_ADDR_COPY(rt->rt_dest, dest); @@ -360,7 +361,7 @@ mesh_rt_del(struct ieee80211_mesh_state RT_ENTRY_LOCK(rt); callout_drain(&rt->rt_discovery); mtx_destroy(&rt->rt_lock); - free(rt, M_80211_MESH_RT); + IEEE80211_FREE(rt, M_80211_MESH_RT); } void @@ -654,7 +655,7 @@ mesh_vdetach(struct ieee80211vap *vap) ieee80211_mesh_rt_flush(vap); mtx_destroy(&ms->ms_rt_lock); ms->ms_ppath->mpp_vdetach(vap); - free(vap->iv_mesh, M_80211_VAP); + IEEE80211_FREE(vap->iv_mesh, M_80211_VAP); vap->iv_mesh = NULL; } @@ -667,8 +668,8 @@ mesh_vattach(struct ieee80211vap *vap) vap->iv_opdetach = mesh_vdetach; vap->iv_recv_mgmt = mesh_recv_mgmt; vap->iv_recv_ctl = mesh_recv_ctl; - ms = malloc(sizeof(struct ieee80211_mesh_state), M_80211_VAP, - M_NOWAIT | M_ZERO); + ms = IEEE80211_MALLOC(sizeof(struct ieee80211_mesh_state), M_80211_VAP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ms == NULL) { printf("%s: couldn't alloc MBSS state\n", __func__); return; @@ -885,8 +886,9 @@ ieee80211_mesh_mark_gate(struct ieee8021 /* New mesh gate add it to known table. */ IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, addr, "%s", "stored new gate information from pro-PREQ."); - gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), - M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); + gr = IEEE80211_MALLOC(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), + M_80211_MESH_GT_RT, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); IEEE80211_ADDR_COPY(gr->gr_addr, addr); TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); } @@ -2643,8 +2645,9 @@ mesh_recv_action_meshgate(struct ieee802 /* this GANN is from a new mesh Gate add it to known table. */ IEEE80211_NOTE_MAC(vap, IEEE80211_MSG_MESH, ie.gann_addr, "stored new GANN information, seq %u.", ie.gann_seq); - gr = malloc(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), - M_80211_MESH_GT_RT, M_NOWAIT | M_ZERO); + gr = IEEE80211_MALLOC(ALIGN(sizeof(struct ieee80211_mesh_gate_route)), + M_80211_MESH_GT_RT, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); IEEE80211_ADDR_COPY(gr->gr_addr, ie.gann_addr); TAILQ_INSERT_TAIL(&ms->ms_known_gates, gr, gr_next); } @@ -3491,7 +3494,8 @@ mesh_ioctl_get80211(struct ieee80211vap } ireq->i_len = len; /* XXX M_WAIT? */ - p = malloc(len, M_TEMP, M_NOWAIT | M_ZERO); + p = IEEE80211_MALLOC(len, M_TEMP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (p == NULL) return ENOMEM; off = 0; @@ -3516,7 +3520,7 @@ mesh_ioctl_get80211(struct ieee80211vap MESH_RT_UNLOCK(ms); error = copyout(p, (uint8_t *)ireq->i_data, ireq->i_len); - free(p, M_TEMP); + IEEE80211_FREE(p, M_TEMP); break; case IEEE80211_MESH_RTCMD_FLUSH: case IEEE80211_MESH_RTCMD_ADD: Modified: head/sys/net80211/ieee80211_node.c ============================================================================== --- head/sys/net80211/ieee80211_node.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_node.c Mon May 25 19:18:16 2015 (r283538) @@ -172,9 +172,10 @@ ieee80211_node_latevattach(struct ieee80 "WARNING: max aid too small, changed to %d\n", vap->iv_max_aid); } - vap->iv_aid_bitmap = (uint32_t *) malloc( + vap->iv_aid_bitmap = (uint32_t *) IEEE80211_MALLOC( howmany(vap->iv_max_aid, 32) * sizeof(uint32_t), - M_80211_NODE, M_NOWAIT | M_ZERO); + M_80211_NODE, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (vap->iv_aid_bitmap == NULL) { /* XXX no way to recover */ printf("%s: no memory for AID bitmap, max aid %d!\n", @@ -199,7 +200,7 @@ ieee80211_node_vdetach(struct ieee80211v vap->iv_bss = NULL; } if (vap->iv_aid_bitmap != NULL) { - free(vap->iv_aid_bitmap, M_80211_NODE); + IEEE80211_FREE(vap->iv_aid_bitmap, M_80211_NODE); vap->iv_aid_bitmap = NULL; } } @@ -892,8 +893,8 @@ node_alloc(struct ieee80211vap *vap, con { struct ieee80211_node *ni; - ni = (struct ieee80211_node *) malloc(sizeof(struct ieee80211_node), - M_80211_NODE, M_NOWAIT | M_ZERO); + ni = (struct ieee80211_node *) IEEE80211_MALLOC(sizeof(struct ieee80211_node), + M_80211_NODE, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); return ni; } @@ -910,11 +911,12 @@ ieee80211_ies_init(struct ieee80211_ies memset(ies, 0, offsetof(struct ieee80211_ies, data)); if (ies->data != NULL && ies->len != len) { /* data size changed */ - free(ies->data, M_80211_NODE_IE); + IEEE80211_FREE(ies->data, M_80211_NODE_IE); ies->data = NULL; } if (ies->data == NULL) { - ies->data = (uint8_t *) malloc(len, M_80211_NODE_IE, M_NOWAIT); + ies->data = (uint8_t *) IEEE80211_MALLOC(len, M_80211_NODE_IE, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ies->data == NULL) { ies->len = 0; /* NB: pointers have already been zero'd above */ @@ -933,7 +935,7 @@ void ieee80211_ies_cleanup(struct ieee80211_ies *ies) { if (ies->data != NULL) - free(ies->data, M_80211_NODE_IE); + IEEE80211_FREE(ies->data, M_80211_NODE_IE); } /* @@ -1045,7 +1047,7 @@ node_cleanup(struct ieee80211_node *ni) ni->ni_associd = 0; if (ni->ni_challenge != NULL) { - free(ni->ni_challenge, M_80211_NODE); + IEEE80211_FREE(ni->ni_challenge, M_80211_NODE); ni->ni_challenge = NULL; } /* @@ -1080,7 +1082,7 @@ node_free(struct ieee80211_node *ni) ic->ic_node_cleanup(ni); ieee80211_ies_cleanup(&ni->ni_ies); ieee80211_psq_cleanup(&ni->ni_psq); - free(ni, M_80211_NODE); + IEEE80211_FREE(ni, M_80211_NODE); } static void @@ -1918,9 +1920,10 @@ ieee80211_node_table_init(struct ieee802 nt->nt_inact_init = inact; nt->nt_keyixmax = keyixmax; if (nt->nt_keyixmax > 0) { - nt->nt_keyixmap = (struct ieee80211_node **) malloc( + nt->nt_keyixmap = (struct ieee80211_node **) IEEE80211_MALLOC( keyixmax * sizeof(struct ieee80211_node *), - M_80211_NODE, M_NOWAIT | M_ZERO); + M_80211_NODE, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (nt->nt_keyixmap == NULL) ic_printf(ic, "Cannot allocate key index map with %u entries\n", @@ -1979,7 +1982,7 @@ ieee80211_node_table_cleanup(struct ieee printf("%s: %s[%u] still active\n", __func__, nt->nt_name, i); #endif - free(nt->nt_keyixmap, M_80211_NODE); + IEEE80211_FREE(nt->nt_keyixmap, M_80211_NODE); nt->nt_keyixmap = NULL; } IEEE80211_NODE_ITERATE_LOCK_DESTROY(nt); @@ -2318,8 +2321,8 @@ ieee80211_iterate_nodes(struct ieee80211 max_aid = vap->iv_max_aid; size = max_aid * sizeof(struct ieee80211_node *); - ni_arr = (struct ieee80211_node **) malloc(size, M_80211_NODE, - M_NOWAIT | M_ZERO); + ni_arr = (struct ieee80211_node **) IEEE80211_MALLOC(size, M_80211_NODE, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ni_arr == NULL) return; @@ -2342,7 +2345,7 @@ ieee80211_iterate_nodes(struct ieee80211 } done: - free(ni_arr, M_80211_NODE); + IEEE80211_FREE(ni_arr, M_80211_NODE); } void Modified: head/sys/net80211/ieee80211_output.c ============================================================================== --- head/sys/net80211/ieee80211_output.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_output.c Mon May 25 19:18:16 2015 (r283538) @@ -1950,7 +1950,7 @@ ieee80211_add_countryie(uint8_t *frm, st * re-calculation. */ if (ic->ic_countryie != NULL) - free(ic->ic_countryie, M_80211_NODE_IE); + IEEE80211_FREE(ic->ic_countryie, M_80211_NODE_IE); ic->ic_countryie = ieee80211_alloc_countryie(ic); if (ic->ic_countryie == NULL) return frm; Modified: head/sys/net80211/ieee80211_power.c ============================================================================== --- head/sys/net80211/ieee80211_power.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_power.c Mon May 25 19:18:16 2015 (r283538) @@ -83,8 +83,9 @@ ieee80211_power_latevattach(struct ieee8 */ if (vap->iv_opmode == IEEE80211_M_HOSTAP) { vap->iv_tim_len = howmany(vap->iv_max_aid,8) * sizeof(uint8_t); - vap->iv_tim_bitmap = (uint8_t *) malloc(vap->iv_tim_len, - M_80211_POWER, M_NOWAIT | M_ZERO); + vap->iv_tim_bitmap = (uint8_t *) IEEE80211_MALLOC(vap->iv_tim_len, + M_80211_POWER, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (vap->iv_tim_bitmap == NULL) { printf("%s: no memory for TIM bitmap!\n", __func__); /* XXX good enough to keep from crashing? */ @@ -97,7 +98,7 @@ void ieee80211_power_vdetach(struct ieee80211vap *vap) { if (vap->iv_tim_bitmap != NULL) { - free(vap->iv_tim_bitmap, M_80211_POWER); + IEEE80211_FREE(vap->iv_tim_bitmap, M_80211_POWER); vap->iv_tim_bitmap = NULL; } } Modified: head/sys/net80211/ieee80211_proto.c ============================================================================== --- head/sys/net80211/ieee80211_proto.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_proto.c Mon May 25 19:18:16 2015 (r283538) @@ -250,7 +250,7 @@ ieee80211_proto_vdetach(struct ieee80211 { #define FREEAPPIE(ie) do { \ if (ie != NULL) \ - free(ie, M_80211_NODE_IE); \ + IEEE80211_FREE(ie, M_80211_NODE_IE); \ } while (0) /* * Detach operating mode module. Modified: head/sys/net80211/ieee80211_ratectl_none.c ============================================================================== --- head/sys/net80211/ieee80211_ratectl_none.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_ratectl_none.c Mon May 25 19:18:16 2015 (r283538) @@ -56,7 +56,7 @@ none_init(struct ieee80211vap *vap) static void none_deinit(struct ieee80211vap *vap) { - free(vap->iv_rs, M_80211_RATECTL); + IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); } static void Modified: head/sys/net80211/ieee80211_regdomain.c ============================================================================== --- head/sys/net80211/ieee80211_regdomain.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_regdomain.c Mon May 25 19:18:16 2015 (r283538) @@ -84,7 +84,7 @@ void ieee80211_regdomain_detach(struct ieee80211com *ic) { if (ic->ic_countryie != NULL) { - free(ic->ic_countryie, M_80211_NODE_IE); + IEEE80211_FREE(ic->ic_countryie, M_80211_NODE_IE); ic->ic_countryie = NULL; } } @@ -301,8 +301,8 @@ ieee80211_alloc_countryie(struct ieee802 struct ieee80211_country_ie *ie; int i, skip, nruns; - aie = malloc(IEEE80211_COUNTRY_MAX_SIZE, M_80211_NODE_IE, - M_NOWAIT | M_ZERO); + aie = IEEE80211_MALLOC(IEEE80211_COUNTRY_MAX_SIZE, M_80211_NODE_IE, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (aie == NULL) { ic_printf(ic, "%s: unable to allocate memory for country ie\n", __func__); @@ -493,7 +493,7 @@ ieee80211_setregdomain(struct ieee80211v * Invalidate channel-related state. */ if (ic->ic_countryie != NULL) { - free(ic->ic_countryie, M_80211_NODE_IE); + IEEE80211_FREE(ic->ic_countryie, M_80211_NODE_IE); ic->ic_countryie = NULL; } ieee80211_scan_flush(vap); Modified: head/sys/net80211/ieee80211_rssadapt.c ============================================================================== --- head/sys/net80211/ieee80211_rssadapt.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_rssadapt.c Mon May 25 19:18:16 2015 (r283538) @@ -132,8 +132,8 @@ rssadapt_init(struct ieee80211vap *vap) KASSERT(vap->iv_rs == NULL, ("%s: iv_rs already initialized", __func__)); - vap->iv_rs = rs = malloc(sizeof(struct ieee80211_rssadapt), - M_80211_RATECTL, M_NOWAIT|M_ZERO); + vap->iv_rs = rs = IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt), + M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (rs == NULL) { if_printf(vap->iv_ifp, "couldn't alloc ratectl structure\n"); return; @@ -146,7 +146,7 @@ rssadapt_init(struct ieee80211vap *vap) static void rssadapt_deinit(struct ieee80211vap *vap) { - free(vap->iv_rs, M_80211_RATECTL); + IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); } static void @@ -175,8 +175,8 @@ rssadapt_node_init(struct ieee80211_node if (ni->ni_rctls == NULL) { ni->ni_rctls = ra = - malloc(sizeof(struct ieee80211_rssadapt_node), - M_80211_RATECTL, M_NOWAIT|M_ZERO); + IEEE80211_MALLOC(sizeof(struct ieee80211_rssadapt_node), + M_80211_RATECTL, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ra == NULL) { if_printf(vap->iv_ifp, "couldn't alloc per-node ratectl " "structure\n"); @@ -204,7 +204,7 @@ static void rssadapt_node_deinit(struct ieee80211_node *ni) { - free(ni->ni_rctls, M_80211_RATECTL); + IEEE80211_FREE(ni->ni_rctls, M_80211_RATECTL); } static __inline int Modified: head/sys/net80211/ieee80211_scan_sta.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sta.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_scan_sta.c Mon May 25 19:18:16 2015 (r283538) @@ -159,8 +159,9 @@ sta_attach(struct ieee80211_scan_state * { struct sta_table *st; - st = (struct sta_table *) malloc(sizeof(struct sta_table), - M_80211_SCAN, M_NOWAIT | M_ZERO); + st = (struct sta_table *) IEEE80211_MALLOC(sizeof(struct sta_table), + M_80211_SCAN, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (st == NULL) return 0; IEEE80211_SCAN_TABLE_LOCK_INIT(st, "scantable"); @@ -183,7 +184,7 @@ sta_detach(struct ieee80211_scan_state * sta_flush_table(st); IEEE80211_SCAN_TABLE_LOCK_DESTROY(st); mtx_destroy(&st->st_scanlock); - free(st, M_80211_SCAN); + IEEE80211_FREE(st, M_80211_SCAN); KASSERT(nrefs > 0, ("imbalanced attach/detach")); nrefs--; /* NB: we assume caller locking */ } @@ -217,7 +218,7 @@ sta_flush_table(struct sta_table *st) TAILQ_REMOVE(&st->st_entry, se, se_list); LIST_REMOVE(se, se_hash); ieee80211_ies_cleanup(&se->base.se_ies); - free(se, M_80211_SCAN); + IEEE80211_FREE(se, M_80211_SCAN); } memset(st->st_maxrssi, 0, sizeof(st->st_maxrssi)); } @@ -252,8 +253,8 @@ sta_add(struct ieee80211_scan_state *ss, LIST_FOREACH(se, &st->st_hash[hash], se_hash) if (IEEE80211_ADDR_EQ(se->base.se_macaddr, macaddr)) goto found; - se = (struct sta_entry *) malloc(sizeof(struct sta_entry), - M_80211_SCAN, M_NOWAIT | M_ZERO); + se = (struct sta_entry *) IEEE80211_MALLOC(sizeof(struct sta_entry), + M_80211_SCAN, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (se == NULL) { IEEE80211_SCAN_TABLE_UNLOCK(st); return 0; @@ -1680,7 +1681,7 @@ adhoc_age(struct ieee80211_scan_state *s TAILQ_REMOVE(&st->st_entry, se, se_list); LIST_REMOVE(se, se_hash); ieee80211_ies_cleanup(&se->base.se_ies); - free(se, M_80211_SCAN); + IEEE80211_FREE(se, M_80211_SCAN); } } IEEE80211_SCAN_TABLE_UNLOCK(st); Modified: head/sys/net80211/ieee80211_scan_sw.c ============================================================================== --- head/sys/net80211/ieee80211_scan_sw.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_scan_sw.c Mon May 25 19:18:16 2015 (r283538) @@ -107,8 +107,8 @@ ieee80211_swscan_attach(struct ieee80211 { struct scan_state *ss; - ss = (struct scan_state *) malloc(sizeof(struct scan_state), - M_80211_SCAN, M_NOWAIT | M_ZERO); + ss = (struct scan_state *) IEEE80211_MALLOC(sizeof(struct scan_state), + M_80211_SCAN, IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ss == NULL) { ic->ic_scan = NULL; return; @@ -155,7 +155,7 @@ ieee80211_swscan_detach(struct ieee80211 ss->ss_ops = NULL; } ic->ic_scan = NULL; - free(SCAN_PRIVATE(ss), M_80211_SCAN); + IEEE80211_FREE(SCAN_PRIVATE(ss), M_80211_SCAN); } } Modified: head/sys/net80211/ieee80211_sta.c ============================================================================== --- head/sys/net80211/ieee80211_sta.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_sta.c Mon May 25 19:18:16 2015 (r283538) @@ -1060,7 +1060,7 @@ sta_auth_shared(struct ieee80211_node *n switch (seq) { case IEEE80211_AUTH_SHARED_PASS: if (ni->ni_challenge != NULL) { - free(ni->ni_challenge, M_80211_NODE); + IEEE80211_FREE(ni->ni_challenge, M_80211_NODE); ni->ni_challenge = NULL; } if (status != 0) { Modified: head/sys/net80211/ieee80211_superg.c ============================================================================== --- head/sys/net80211/ieee80211_superg.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_superg.c Mon May 25 19:18:16 2015 (r283538) @@ -100,9 +100,9 @@ ieee80211_superg_attach(struct ieee80211 struct ieee80211_superg *sg; if (ic->ic_caps & IEEE80211_C_FF) { - sg = (struct ieee80211_superg *) malloc( + sg = (struct ieee80211_superg *) IEEE80211_MALLOC( sizeof(struct ieee80211_superg), M_80211_VAP, - M_NOWAIT | M_ZERO); + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (sg == NULL) { printf("%s: cannot allocate SuperG state block\n", __func__); @@ -117,7 +117,7 @@ void ieee80211_superg_detach(struct ieee80211com *ic) { if (ic->ic_superg != NULL) { - free(ic->ic_superg, M_80211_VAP); + IEEE80211_FREE(ic->ic_superg, M_80211_VAP); ic->ic_superg = NULL; } } Modified: head/sys/net80211/ieee80211_tdma.c ============================================================================== --- head/sys/net80211/ieee80211_tdma.c Mon May 25 18:50:26 2015 (r283537) +++ head/sys/net80211/ieee80211_tdma.c Mon May 25 19:18:16 2015 (r283538) @@ -149,8 +149,9 @@ ieee80211_tdma_vattach(struct ieee80211v KASSERT(vap->iv_caps & IEEE80211_C_TDMA, ("not a tdma vap, caps 0x%x", vap->iv_caps)); - ts = (struct ieee80211_tdma_state *) malloc( - sizeof(struct ieee80211_tdma_state), M_80211_VAP, M_NOWAIT | M_ZERO); + ts = (struct ieee80211_tdma_state *) IEEE80211_MALLOC( + sizeof(struct ieee80211_tdma_state), M_80211_VAP, + IEEE80211_M_NOWAIT | IEEE80211_M_ZERO); if (ts == NULL) { printf("%s: cannot allocate TDMA state block\n", __func__); /* NB: fall back to adhdemo mode */ @@ -199,7 +200,7 @@ tdma_vdetach(struct ieee80211vap *vap) return; } ts->tdma_opdetach(vap); - free(vap->iv_tdma, M_80211_VAP); + IEEE80211_FREE(vap->iv_tdma, M_80211_VAP); vap->iv_tdma = NULL; setackpolicy(vap->iv_ic, 0); /* enable ACK's */