From: Alexandru Hossu Date: Thu, 5 Mar 2026 10:23:18 +0000 (+0100) Subject: staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie X-Git-Tag: v7.1-rc1~81^2~65 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e43627a7bf80747c68688e8e06518791f01c8147;p=thirdparty%2Flinux.git staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie Replace open-coded kzalloc()+memcpy() with kmemdup() to simplify the code. Signed-off-by: Alexandru Hossu Reviewed-by: Dan Carpenter Link: https://patch.msgid.link/20260305102318.43034-1-hossu.alexandru@gmail.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c index 47cba32375d9..453ba1db773f 100644 --- a/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c @@ -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;