Skip to contentSkip to conversation

Staging: rtl8188eu: Replaced kzalloc and memcpy combination with kmemdup

PATCH In review Dhere, Chaitanya (C.) 2 participants 2 messages Apr 7, 2015 – Apr 8, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Staging: rtl8188eu: Replaced kzalloc and memcpy combination with kmemdup

This change was detected with the help of coccinelle tool. It performs the same function as kzalloc amd memcpy.

---
 drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +2 -3
index 86d955f..07ae6cf 100644
@@ -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);
Signature · 1 line
1.9.1
#1 lore raw
Quoted 4 lines · Chaitanya (C.)

This change was detected with the help of coccinelle tool. It performs the same function as kzalloc amd memcpy.

your From: name and this name does not match.

regards
sudip