Staging: Use kmemdup
[safe/jmp/linux-2.6] / drivers / staging / rtl8187se / ieee80211 / ieee80211_softmac.c
index b7426fe..1b838a2 100644 (file)
@@ -2667,11 +2667,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;