* [PATCH] staging: r8188eu: Use kmemdup() to replace kmalloc + memcpy
@ 2021-10-03 7:28 Kai Song
0 siblings, 0 replies; only message in thread
From: Kai Song @ 2021-10-03 7:28 UTC (permalink / raw)
To: gregkh
Cc: Larry.Finger, phil, straube.linux, fmdefrancesco, martin,
linux-staging, linux-kernel, Kai Song
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@inspur.com>
---
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-03 7:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-03 7:28 [PATCH] staging: r8188eu: Use kmemdup() to replace kmalloc + memcpy Kai Song
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.