Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ericvh...
[pandora-kernel.git] / drivers / staging / rtl8192su / ieee80211 / ieee80211_softmac.c
index 84a4e23..4f1f2f0 100644 (file)
@@ -1557,7 +1557,7 @@ static inline u16 auth_parse(struct sk_buff *skb, u8** challenge, int *chlen)
 
                if(*(t++) == MFIE_TYPE_CHALLENGE){
                        *chlen = *(t++);
-                       *challenge = (u8*)kmalloc(*chlen, GFP_ATOMIC);
+                       *challenge = kmalloc(*chlen, GFP_ATOMIC);
                        memcpy(*challenge, t, *chlen);
                }
        }
@@ -1691,7 +1691,8 @@ ieee80211_rx_auth_rq(struct ieee80211_device *ieee, struct sk_buff *skb)
        //IEEE80211DMESG("Rx probe");
        ieee->softmac_stats.rx_auth_rq++;
 
-       if ((status = auth_rq_parse(skb, dest))!= -1){
+       status = auth_rq_parse(skb, dest);
+       if (status != -1) {
                ieee80211_resp_to_auth(ieee, status, dest);
        }
        //DMESG("Dest is "MACSTR, MAC2STR(dest));
@@ -2698,10 +2699,9 @@ void ieee80211_softmac_init(struct ieee80211_device *ieee)
        for(i = 0; i < 5; i++) {
          ieee->seq_ctrl[i] = 0;
        }
-       ieee->pDot11dInfo = kmalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
+       ieee->pDot11dInfo = kzalloc(sizeof(RT_DOT11D_INFO), GFP_ATOMIC);
        if (!ieee->pDot11dInfo)
                IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for DOT11D\n");
-       memset(ieee->pDot11dInfo, 0, sizeof(RT_DOT11D_INFO));
        //added for  AP roaming
        ieee->LinkDetectInfo.SlotNum = 2;
        ieee->LinkDetectInfo.NumRecvBcnInPeriod=0;
@@ -2844,11 +2844,11 @@ static int ieee80211_wpa_set_wpa_ie(struct ieee80211_device *ieee,
                return -EINVAL;
 
        if (param->u.wpa_ie.len) {
-               buf = kmalloc(param->u.wpa_ie.len, GFP_KERNEL);
+               buf = kmemdup(param->u.wpa_ie.data, param->u.wpa_ie.len,
+                             GFP_KERNEL);
                if (buf == NULL)
                        return -ENOMEM;
 
-               memcpy(buf, param->u.wpa_ie.data, param->u.wpa_ie.len);
                kfree(ieee->wpa_ie);
                ieee->wpa_ie = buf;
                ieee->wpa_ie_len = param->u.wpa_ie.len;
@@ -3047,8 +3047,7 @@ static int ieee80211_wpa_set_encryption(struct ieee80211_device *ieee,
 
                ieee80211_crypt_delayed_deinit(ieee, crypt);
 
-               new_crypt = (struct ieee80211_crypt_data *)
-                       kmalloc(sizeof(*new_crypt), GFP_KERNEL);
+               new_crypt = kmalloc(sizeof(*new_crypt), GFP_KERNEL);
                if (new_crypt == NULL) {
                        ret = -ENOMEM;
                        goto done;
@@ -3181,7 +3180,7 @@ int ieee80211_wpa_supplicant_ioctl(struct ieee80211_device *ieee, struct iw_poin
                goto out;
        }
 
-       param = (struct ieee_param *)kmalloc(p->length, GFP_KERNEL);
+       param = kmalloc(p->length, GFP_KERNEL);
        if (param == NULL){
                ret = -ENOMEM;
                goto out;