Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] mac80211: use exact-size allocation for authentication frame
@ 2013-09-24  2:33 Fred Zhou
  2013-10-01 10:20 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Fred Zhou @ 2013-09-24  2:33 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, 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).

Signed-off-by: Fred Zhou <fred.zy@gmail.com>
---
 net/mac80211/util.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index e1b34a1..674ab12 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -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;
 
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-01 10:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-24  2:33 [PATCH] mac80211: use exact-size allocation for authentication frame Fred Zhou
2013-10-01 10:20 ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox