summaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc/emi26.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc/emi26.c')
-rw-r--r--drivers/usb/misc/emi26.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index 1fd9cb8..5c0a26c 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -53,13 +53,12 @@ static void __exit emi26_exit (void);
static int emi26_writememory (struct usb_device *dev, int address, unsigned char *data, int length, __u8 request)
{
int result;
- unsigned char *buffer = kmalloc (length, GFP_KERNEL);
+ unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);
if (!buffer) {
err("emi26: kmalloc(%d) failed.", length);
return -ENOMEM;
}
- memcpy (buffer, data, length);
/* Note: usb_control_msg returns negative value on error or length of the
* data that was written! */
result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300);
OpenPOWER on IntegriCloud