lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20211003072841.215903-1-songkai01@inspur.com>
Date:   Sun, 3 Oct 2021 15:28:41 +0800
From:   Kai Song <songkai01@...pur.com>
To:     <gregkh@...uxfoundation.org>
CC:     <Larry.Finger@...inger.net>, <phil@...lpotter.co.uk>,
        <straube.linux@...il.com>, <fmdefrancesco@...il.com>,
        <martin@...ser.cx>, <linux-staging@...ts.linux.dev>,
        <linux-kernel@...r.kernel.org>, Kai Song <songkai01@...pur.com>
Subject: [PATCH] staging: r8188eu: Use kmemdup() to replace kmalloc + memcpy

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@...pur.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ