]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
staging: rtl8723bs: use kmemdup() in rtw_cfg80211_set_wpa_ie
authorAlexandru Hossu <hossu.alexandru@gmail.com>
Thu, 5 Mar 2026 10:23:18 +0000 (11:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 9 Mar 2026 16:47:00 +0000 (17:47 +0100)
Replace open-coded kzalloc()+memcpy() with kmemdup() to simplify the code.

Signed-off-by: Alexandru Hossu <hossu.alexandru@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://patch.msgid.link/20260305102318.43034-1-hossu.alexandru@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c

index 47cba32375d9bd5460ab9eadcffff258691665b0..453ba1db773fc01f603a0a16669b24a5cf7af290 100644 (file)
@@ -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;