Skip to contentSkip to conversation

staging: rtl8723bs: replace kzalloc/memcpy with kmemdup

PATCH Superseded starPt 2 participants 2 messages Mar 8 Staging

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

starPt

author
#0 lore raw

PATCH 1/1 staging: rtl8723bs: replace kzalloc/memcpy with kmemdup

Replace the open-coded kzalloc and memcpy combination with kmemdup() to make the code more concise and idiomatic.

---
 drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +1 -3
index 7cb0c6f22bf3..2125606f7775 100644
@@ -1430,14 +1430,12 @@ static int rtw_cfg80211_set_wpa_ie(struct adapter *padapter, u8 *pie, size_t iel
 		goto exit;
 	}
 
-	buf = kzalloc(ielen, GFP_KERNEL);
+	buf = kmemdup(pie, ielen, GFP_KERNEL);
 	if (!buf) {
 		ret =  -ENOMEM;
 		goto exit;
 	}
 
-	memcpy(buf, pie, ielen);
-
 	if (ielen < RSN_HEADER_LEN) {
 		ret  = -1;
 		goto exit;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 4 lines · starPt

Replace the open-coded kzalloc and memcpy combination with kmemdup() to make the code more concise and idiomatic.

You must use your real name.

Thanks,

ET