fix memdup.cocci warning: drivers/staging/r8188eu/os_dep/ioctl_linux.c:4452:33-40: WARNING opportunity for kmemdup Generated by: scripts/coccinelle/api/memdup.cocci Signed-off-by: Kai Song <songkai01@xxxxxxxxxx> --- drivers/staging/r8188eu/os_dep/ioctl_linux.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/r8188eu/os_dep/ioctl_linux.c b/drivers/staging/r8188eu/os_dep/ioctl_linux.c index 20f6182fd93c..71843690356a 100644 --- a/drivers/staging/r8188eu/os_dep/ioctl_linux.c +++ b/drivers/staging/r8188eu/os_dep/ioctl_linux.c @@ -4189,12 +4189,11 @@ static int rtw_wx_set_priv(struct net_device *dev, kfree(pmlmepriv->wps_probe_req_ie); pmlmepriv->wps_probe_req_ie = NULL; - pmlmepriv->wps_probe_req_ie = kmalloc(cp_sz, GFP_KERNEL); + pmlmepriv->wps_probe_req_ie = kmemdup(probereq_wpsie, cp_sz, GFP_KERNEL); if (!pmlmepriv->wps_probe_req_ie) { ret = -EINVAL; goto FREE_EXT; } - memcpy(pmlmepriv->wps_probe_req_ie, probereq_wpsie, cp_sz); pmlmepriv->wps_probe_req_ie_len = cp_sz; } goto FREE_EXT; -- 2.27.0