]> git.karo-electronics.de Git - linux-beck.git/commitdiff
Staging: rtl8188eu: replace kzalloc and memcpy by kmemdup
authorNiranjan Dighe <niranjan.dighe@gmail.com>
Tue, 24 Mar 2015 19:16:33 +0000 (00:46 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 26 Mar 2015 12:16:19 +0000 (13:16 +0100)
This was generated by 'make coccicheck' using scripts at
scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c

index 86d955fadc4b2da543431d14794efcb0acdb43d1..be9e34a0daef836baa7330fe92c2a8379052dc19 100644 (file)
@@ -5431,15 +5431,14 @@ u8 set_tx_beacon_cmd(struct adapter *padapter)
                goto exit;
        }
 
-       ptxBeacon_parm = kzalloc(sizeof(struct wlan_bssid_ex), GFP_KERNEL);
+       ptxBeacon_parm = kmemdup(&(pmlmeinfo->network),
+                               sizeof(struct wlan_bssid_ex), GFP_KERNEL);
        if (ptxBeacon_parm == NULL) {
                kfree(ph2c);
                res = _FAIL;
                goto exit;
        }
 
-       memcpy(ptxBeacon_parm, &(pmlmeinfo->network), sizeof(struct wlan_bssid_ex));
-
        len_diff = update_hidden_ssid(ptxBeacon_parm->IEs+_BEACON_IE_OFFSET_,
                                      ptxBeacon_parm->IELength-_BEACON_IE_OFFSET_,
                                      pmlmeinfo->hidden_ssid_mode);