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 for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.20.1803262138530.2423@hadrien>
Date:   Mon, 26 Mar 2018 21:41:30 +0200 (CEST)
From:   Julia Lawall <julia.lawall@...6.fr>
To:     Colin Ian King <colin.king@...onical.com>
cc:     kbuild-all@...org, devel@...verdev.osuosl.org,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Aditya Shankar <aditya.shankar@...rochip.com>,
        Ganesh Krishna <ganesh.krishna@...rochip.com>,
        linux-wireless@...r.kernel.org, devel@...verdev.osuosl.org,
        linux-kernel@...r.kernel.org
Subject: [PATCH] staging: wilc1000: fix memdup.cocci warnings

From: Fengguang Wu <fengguang.wu@...el.com>

drivers/staging/wilc1000/host_interface.c:946:32-39: WARNING opportunity for kmemdup
drivers/staging/wilc1000/host_interface.c:970:30-37: WARNING opportunity for kmemdup

 Use kmemdup rather than duplicating its implementation

Generated by: scripts/coccinelle/api/memdup.cocci

Fixes: aaea2164bdff ("staging: wilc1000: check for kmalloc allocation failures")
CC: Colin Ian King <colin.king@...onical.com>
Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
Signed-off-by: Julia Lawall <julia.lawall@...6.fr>
---

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
staging-next
head:   12a0148711a440f5b7111f95a34dfce88cdb47d6
commit: aaea2164bdff39697d0f1ec69dcae62632e37974 [400/412] staging:
wilc1000: check for kmalloc allocation failures

In the first hunk, should 6 be ETH_ALEN?

 host_interface.c |   10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

--- a/drivers/staging/wilc1000/host_interface.c
+++ b/drivers/staging/wilc1000/host_interface.c
@@ -943,12 +943,12 @@ static s32 handle_connect(struct wilc_vi
 	}

 	if (conn_attr->bssid) {
-		hif_drv->usr_conn_req.bssid = kmalloc(6, GFP_KERNEL);
+		hif_drv->usr_conn_req.bssid = kmemdup(conn_attr->bssid, 6,
+						      GFP_KERNEL);
 		if (!hif_drv->usr_conn_req.bssid) {
 			result = -ENOMEM;
 			goto error;
 		}
-		memcpy(hif_drv->usr_conn_req.bssid, conn_attr->bssid, 6);
 	}

 	hif_drv->usr_conn_req.ssid_len = conn_attr->ssid_len;
@@ -967,15 +967,13 @@ static s32 handle_connect(struct wilc_vi

 	hif_drv->usr_conn_req.ies_len = conn_attr->ies_len;
 	if (conn_attr->ies) {
-		hif_drv->usr_conn_req.ies = kmalloc(conn_attr->ies_len,
+		hif_drv->usr_conn_req.ies = kmemdup(conn_attr->ies,
+						    conn_attr->ies_len,
 						    GFP_KERNEL);
 		if (!hif_drv->usr_conn_req.ies) {
 			result = -ENOMEM;
 			goto error;
 		}
-		memcpy(hif_drv->usr_conn_req.ies,
-		       conn_attr->ies,
-		       conn_attr->ies_len);
 	}

 	hif_drv->usr_conn_req.security = conn_attr->security;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ