Skip to contentSkip to conversation

mac80211: use exact-size allocation for authentication frame

PATCH In review Fred Zhou 2 participants 2 messages Sep 24, 2013 – Oct 1, 2013 mac80211

lore
Share & tools
lore

Fred Zhou

author
#0 lore raw

PATCH 1/1 mac80211: use exact-size allocation for authentication frame

The authentication frame has a fixied size of 30 bytes (including header, algo num, trans seq num, and status) followed by a variable challenge text. Allocate using exact size, instead of over-allocation by sizeof(ieee80211_mgmt).

---
 net/mac80211/util.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
net/mac80211/util.c +3 -2
index e1b34a1..674ab12 100644
@@ -1083,9 +1083,10 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
 	struct sk_buff *skb;
 	struct ieee80211_mgmt *mgmt;
 	int err;
-
+
+	/* 30 = header + auth_algo + auth_transaction + status_code */
 	skb = dev_alloc_skb(local->hw.extra_tx_headroom +
-			    sizeof(*mgmt) + 6 + extra_len);
+			    30 + extra_len);
 	if (!skb)
 		return;
 
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 5 lines · Fred Zhou

The authentication frame has a fixied size of 30 bytes (including header, algo num, trans seq num, and status) followed by a variable challenge text. Allocate using exact size, instead of over-allocation by sizeof(ieee80211_mgmt).

Applied (a slightly modified version)

johannes