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>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1321569820.1624.281.camel@localhost.localdomain>
Date:	Thu, 17 Nov 2011 23:43:40 +0100
From:	Thomas Meyer <thomas@...3r.de>
To:	jkosina@...e.cz, linux-input@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] HID: roccat: Use kmemdup rather than duplicating its
 implementation

The semantic patch that makes this change is available
in scripts/coccinelle/api/memdup.cocci.

Signed-off-by: Thomas Meyer <thomas@...3r.de>
---

diff -u -p a/drivers/hid/hid-roccat-common.c b/drivers/hid/hid-roccat-common.c
--- a/drivers/hid/hid-roccat-common.c 2011-11-07 19:39:05.364461084 +0100
+++ b/drivers/hid/hid-roccat-common.c 2011-11-08 10:45:42.781966362 +0100
@@ -49,12 +49,10 @@ int roccat_common_send(struct usb_device
 	char *buf;
 	int len;
 
-	buf = kmalloc(size, GFP_KERNEL);
+	buf = kmemdup(data, size, GFP_KERNEL);
 	if (buf == NULL)
 		return -ENOMEM;
 
-	memcpy(buf, data, size);
-
 	len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
 			HID_REQ_SET_REPORT,
 			USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
diff -u -p a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c
--- a/drivers/hid/hid-roccat-kone.c 2011-11-07 19:37:44.826571091 +0100
+++ b/drivers/hid/hid-roccat-kone.c 2011-11-08 10:45:45.085330572 +0100
@@ -78,12 +78,10 @@ static int kone_send(struct usb_device *
 	char *buf;
 	int len;
 
-	buf = kmalloc(size, GFP_KERNEL);
+	buf = kmemdup(data, size, GFP_KERNEL);
 	if (buf == NULL)
 		return -ENOMEM;
 
-	memcpy(buf, data, size);
-
 	len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
 			HID_REQ_SET_REPORT,
 			USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ