diff --git a/regression/ccmp/test_ccmp.c b/regression/ccmp/test_ccmp.c index 909bb28..512d321 100644 --- a/regression/ccmp/test_ccmp.c +++ b/regression/ccmp/test_ccmp.c @@ -713,28 +713,40 @@ MODULE_PARM_DESC(debug, "Enable IEEE80211_MSG_CRYPTO"); 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 = 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); diff --git a/regression/tkip/test_tkip.c b/regression/tkip/test_tkip.c index 86b9535..6b20577 100644 --- a/regression/tkip/test_tkip.c +++ b/regression/tkip/test_tkip.c @@ -372,28 +372,40 @@ MODULE_PARM_DESC(debug, "Enable IEEE80211_MSG_CRYPTO"); 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 = 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); diff --git a/regression/wep/test_wep.c b/regression/wep/test_wep.c index efc95ad..62d1e1c 100644 --- a/regression/wep/test_wep.c +++ b/regression/wep/test_wep.c @@ -317,27 +317,40 @@ MODULE_PARM_DESC(debug, "Enable IEEE80211_MSG_CRYPTO"); 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 = 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);