staging: rtl8188eu: os_dep: Replaced kzalloc and memcpy with kmemdup
authorTapasweni Pathak <tapaswenipathak@gmail.com>
Tue, 21 Oct 2014 04:18:20 +0000 (09:48 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Oct 2014 04:20:44 +0000 (12:20 +0800)
Replaced calls to kzalloc followed by memcpy with a single call to
kmemdup.

Patch found using coccicheck.

Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8188eu/os_dep/ioctl_linux.c

index d598fec4abbf75df2374c4df014aee5710c4c0be..d8605be07a7175e986a52be9ffbec19d18710b9f 100644 (file)
@@ -512,14 +512,12 @@ static int rtw_set_wpa_ie(struct adapter *padapter, char *pie, unsigned short ie
        }
 
        if (ielen) {
-               buf = kzalloc(ielen, GFP_KERNEL);
+               buf = kmemdup(pie, ielen, GFP_KERNEL);
                if (buf == NULL) {
                        ret =  -ENOMEM;
                        goto exit;
                }
 
-               memcpy(buf, pie, ielen);
-
                /* dump */
                {
                        int i;