aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/misc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/misc')
-rw-r--r--drivers/usb/misc/emi26.c3
-rw-r--r--drivers/usb/misc/emi62.c3
2 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/misc/emi26.c b/drivers/usb/misc/emi26.c
index 1fd9cb85f4ca..5c0a26cbd128 100644
--- a/drivers/usb/misc/emi26.c
+++ b/drivers/usb/misc/emi26.c
@@ -53,13 +53,12 @@ static void __exit emi26_exit (void);
53static int emi26_writememory (struct usb_device *dev, int address, unsigned char *data, int length, __u8 request) 53static int emi26_writememory (struct usb_device *dev, int address, unsigned char *data, int length, __u8 request)
54{ 54{
55 int result; 55 int result;
56 unsigned char *buffer = kmalloc (length, GFP_KERNEL); 56 unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);
57 57
58 if (!buffer) { 58 if (!buffer) {
59 err("emi26: kmalloc(%d) failed.", length); 59 err("emi26: kmalloc(%d) failed.", length);
60 return -ENOMEM; 60 return -ENOMEM;
61 } 61 }
62 memcpy (buffer, data, length);
63 /* Note: usb_control_msg returns negative value on error or length of the 62 /* Note: usb_control_msg returns negative value on error or length of the
64 * data that was written! */ 63 * data that was written! */
65 result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300); 64 result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300);
diff --git a/drivers/usb/misc/emi62.c b/drivers/usb/misc/emi62.c
index fe351371f274..23153eac0dfa 100644
--- a/drivers/usb/misc/emi62.c
+++ b/drivers/usb/misc/emi62.c
@@ -61,13 +61,12 @@ static void __exit emi62_exit (void);
61static int emi62_writememory (struct usb_device *dev, int address, unsigned char *data, int length, __u8 request) 61static int emi62_writememory (struct usb_device *dev, int address, unsigned char *data, int length, __u8 request)
62{ 62{
63 int result; 63 int result;
64 unsigned char *buffer = kmalloc (length, GFP_KERNEL); 64 unsigned char *buffer = kmemdup(data, length, GFP_KERNEL);
65 65
66 if (!buffer) { 66 if (!buffer) {
67 err("emi62: kmalloc(%d) failed.", length); 67 err("emi62: kmalloc(%d) failed.", length);
68 return -ENOMEM; 68 return -ENOMEM;
69 } 69 }
70 memcpy (buffer, data, length);
71 /* Note: usb_control_msg returns negative value on error or length of the 70 /* Note: usb_control_msg returns negative value on error or length of the
72 * data that was written! */ 71 * data that was written! */
73 result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300); 72 result = usb_control_msg (dev, usb_sndctrlpipe(dev, 0), request, 0x40, address, 0, buffer, length, 300);