Gmane
From: Pavel Roskin <svn-commits <at> madwifi.org>
Subject: revision 3847 committed
Newsgroups: gmane.linux.drivers.madwifi.cvs
Date: 2008-08-27 16:04:04 GMT (19 weeks, 2 days, 12 hours and 13 minutes ago)
Project     : madwifi
Revision    : 3847
Author      : proski (Pavel Roskin)
Date        : 2008-08-27 18:04:04 +0200 (Wed, 27 Aug 2008)

Log Message :
Allocate ic and vap dynamically

Affected Files:
* madwifi/branches/madwifi-0.9.4/regression/ccmp/test_ccmp.c  updated             
* madwifi/branches/madwifi-0.9.4/regression/tkip/test_tkip.c  updated             
* madwifi/branches/madwifi-0.9.4/regression/wep/test_wep.c  updated             

Modified: madwifi/branches/madwifi-0.9.4/regression/ccmp/test_ccmp.c
===================================================================
--- madwifi/branches/madwifi-0.9.4/regression/ccmp/test_ccmp.c	2008-08-27 15:58:30 UTC (rev 3846)
+++ madwifi/branches/madwifi-0.9.4/regression/ccmp/test_ccmp.c	2008-08-27 16:04:04 UTC (rev 3847)
@@ -713,28 +713,40 @@
 static int __init
 init_crypto_ccmp_test(void)
 {
-	struct ieee80211com ic;
-	struct ieee80211vap vap;
+	struct ieee80211com *ic;
+	struct ieee80211vap *vap;
 	int i, pass, total;

-	memset(&ic, 0, sizeof(ic));
-	memset(&vap, 0, sizeof(vap));
-	vap.iv_ic = &ic;
+	ic = kzalloc(sizeof(*ic), GFP_KERNEL);
+	if (!ic)
+		return -ENOMEM;
+
+	ieee80211_crypto_attach(ic);
+
+	vap = kzalloc(sizeof(*vap), GFP_KERNEL);
+	if (!vap) {
+		kfree(ic);
+		return -ENOMEM;
+	}
+
+	vap->iv_ic = ic;
 	if (debug)
-		vap.iv_debug = IEEE80211_MSG_CRYPTO;
-	ieee80211_crypto_attach(&ic);
-	ieee80211_crypto_vattach(&vap);
+		vap->iv_debug = IEEE80211_MSG_CRYPTO;

+	ieee80211_crypto_vattach(vap);
+
 	pass = 0;
 	total = 0;
 	for (i = 0; i < ARRAY_SIZE(ccmptests); i++)
 		if (tests & (1 << i)) {
 			total++;
-			pass += runtest(&vap, &ccmptests[i]);
+			pass += runtest(vap, &ccmptests[i]);
 		}
 	printk("%u of %u 802.11i AES-CCMP test vectors passed\n", pass, total);
-	ieee80211_crypto_vdetach(&vap);
-	ieee80211_crypto_detach(&ic);
+	ieee80211_crypto_vdetach(vap);
+	ieee80211_crypto_detach(ic);
+	kfree(vap);
+	kfree(ic);
 	return (pass == total ? 0 : -ENXIO);
 }
 module_init(init_crypto_ccmp_test);

Modified: madwifi/branches/madwifi-0.9.4/regression/tkip/test_tkip.c
===================================================================
--- madwifi/branches/madwifi-0.9.4/regression/tkip/test_tkip.c	2008-08-27 15:58:30 UTC (rev 3846)
+++ madwifi/branches/madwifi-0.9.4/regression/tkip/test_tkip.c	2008-08-27 16:04:04 UTC (rev 3847)
@@ -372,28 +372,40 @@
 static int __init
 init_crypto_tkip_test(void)
 {
-	struct ieee80211com ic;
-	struct ieee80211vap vap;
+	struct ieee80211com *ic;
+	struct ieee80211vap *vap;
 	int i, pass, total;

-	memset(&ic, 0, sizeof(ic));
-	memset(&vap, 0, sizeof(vap));
-	vap.iv_ic = &ic;
+	ic = kzalloc(sizeof(*ic), GFP_KERNEL);
+	if (!ic)
+		return -ENOMEM;
+
+	ieee80211_crypto_attach(ic);
+
+	vap = kzalloc(sizeof(*vap), GFP_KERNEL);
+	if (!vap) {
+		kfree(ic);
+		return -ENOMEM;
+	}
+
+	vap->iv_ic = ic;
 	if (debug)
-		vap.iv_debug = IEEE80211_MSG_CRYPTO;
-	ieee80211_crypto_attach(&ic);
-	ieee80211_crypto_vattach(&vap);
+		vap->iv_debug = IEEE80211_MSG_CRYPTO;

+	ieee80211_crypto_vattach(vap);
+
 	pass = 0;
 	total = 0;
 	for (i = 0; i < ARRAY_SIZE(tkiptests); i++)
 		if (tests & (1 << i)) {
 			total++;
-			pass += runtest(&vap, &tkiptests[i]);
+			pass += runtest(vap, &tkiptests[i]);
 		}
 	printk("%u of %u 802.11i TKIP test vectors passed\n", pass, total);
-	ieee80211_crypto_vdetach(&vap);
-	ieee80211_crypto_detach(&ic);
+	ieee80211_crypto_vdetach(vap);
+	ieee80211_crypto_detach(ic);
+	kfree(vap);
+	kfree(ic);
 	return (pass == total ? 0 : -ENXIO);
 }
 module_init(init_crypto_tkip_test);

Modified: madwifi/branches/madwifi-0.9.4/regression/wep/test_wep.c
===================================================================
--- madwifi/branches/madwifi-0.9.4/regression/wep/test_wep.c	2008-08-27 15:58:30 UTC (rev 3846)
+++ madwifi/branches/madwifi-0.9.4/regression/wep/test_wep.c	2008-08-27 16:04:04 UTC (rev 3847)
@@ -317,27 +317,40 @@
 static int __init
 init_crypto_wep_test(void)
 {
-	struct ieee80211com ic;
-	struct ieee80211vap vap;
+	struct ieee80211com *ic;
+	struct ieee80211vap *vap;
 	int i, pass, total;

-	memset(&ic, 0, sizeof(ic));
-	memset(&vap, 0, sizeof(vap));
-	vap.iv_ic = &ic;
+	ic = kzalloc(sizeof(*ic), GFP_KERNEL);
+	if (!ic)
+		return -ENOMEM;
+
+	ieee80211_crypto_attach(ic);
+
+	vap = kzalloc(sizeof(*vap), GFP_KERNEL);
+	if (!vap) {
+		kfree(ic);
+		return -ENOMEM;
+	}
+
+	vap->iv_ic = ic;
 	if (debug)
-		vap.iv_debug = IEEE80211_MSG_CRYPTO;
-	ieee80211_crypto_attach(&ic);
-	ieee80211_crypto_vattach(&vap);
+		vap->iv_debug = IEEE80211_MSG_CRYPTO;
+
+	ieee80211_crypto_vattach(vap);
+
 	pass = 0;
 	total = 0;
 	for (i = 0; i < ARRAY_SIZE(weptests); i++)
 		if (tests & (1 << i)) {
 			total++;
-			pass += runtest(&vap, &weptests[i]);
+			pass += runtest(vap, &weptests[i]);
 		}
 	printk("%u of %u 802.11i WEP test vectors passed\n", pass, total);
-	ieee80211_crypto_vdetach(&vap);
-	ieee80211_crypto_detach(&ic);
+	ieee80211_crypto_vdetach(vap);
+	ieee80211_crypto_detach(ic);
+	kfree(vap);
+	kfree(ic);
 	return (pass == total ? 0 : -ENXIO);
 }
 module_init(init_crypto_wep_test);

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/