aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/usb/pegasus.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index 1cd17d274a12..974d17f0263e 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -203,13 +203,12 @@ static int set_registers(pegasus_t * pegasus, __u16 indx, __u16 size,
203 char *buffer; 203 char *buffer;
204 DECLARE_WAITQUEUE(wait, current); 204 DECLARE_WAITQUEUE(wait, current);
205 205
206 buffer = kmalloc(size, GFP_KERNEL); 206 buffer = kmemdup(data, size, GFP_KERNEL);
207 if (!buffer) { 207 if (!buffer) {
208 netif_warn(pegasus, drv, pegasus->net, 208 netif_warn(pegasus, drv, pegasus->net,
209 "out of memory in %s\n", __func__); 209 "out of memory in %s\n", __func__);
210 return -ENOMEM; 210 return -ENOMEM;
211 } 211 }
212 memcpy(buffer, data, size);
213 212
214 add_wait_queue(&pegasus->ctrl_wait, &wait); 213 add_wait_queue(&pegasus->ctrl_wait, &wait);
215 set_current_state(TASK_UNINTERRUPTIBLE); 214 set_current_state(TASK_UNINTERRUPTIBLE);
@@ -255,13 +254,12 @@ static int set_register(pegasus_t * pegasus, __u16 indx, __u8 data)
255 char *tmp; 254 char *tmp;
256 DECLARE_WAITQUEUE(wait, current); 255 DECLARE_WAITQUEUE(wait, current);
257 256
258 tmp = kmalloc(1, GFP_KERNEL); 257 tmp = kmemdup(&data, 1, GFP_KERNEL);
259 if (!tmp) { 258 if (!tmp) {
260 netif_warn(pegasus, drv, pegasus->net, 259 netif_warn(pegasus, drv, pegasus->net,
261 "out of memory in %s\n", __func__); 260 "out of memory in %s\n", __func__);
262 return -ENOMEM; 261 return -ENOMEM;
263 } 262 }
264 memcpy(tmp, &data, 1);
265 add_wait_queue(&pegasus->ctrl_wait, &wait); 263 add_wait_queue(&pegasus->ctrl_wait, &wait);
266 set_current_state(TASK_UNINTERRUPTIBLE); 264 set_current_state(TASK_UNINTERRUPTIBLE);
267 while (pegasus->flags & ETH_REGS_CHANGED) 265 while (pegasus->flags & ETH_REGS_CHANGED)