Message ID | Pine.LNX.4.64.1005221024470.13021@ask.diku.dk |
---|---|
State | Accepted |
Delegated to: | David Miller |
Headers | show |
From: Julia Lawall <julia@diku.dk> Date: Sat, 22 May 2010 10:25:03 +0200 (CEST) > From: Julia Lawall <julia@diku.dk> > > Use memdup_user when user data is immediately copied into the > allocated region. > > The semantic patch that makes this change is as follows: > (http://coccinelle.lip6.fr/) ... > Signed-off-by: Julia Lawall <julia@diku.dk> Applied, t hanks Julia. -- To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c index 67fb735..34b9872 100644 --- a/drivers/ide/ide-taskfile.c +++ b/drivers/ide/ide-taskfile.c @@ -480,13 +480,9 @@ int ide_taskfile_ioctl(ide_drive_t *drive, unsigned long arg) u16 nsect = 0; char __user *buf = (char __user *)arg; - req_task = kzalloc(tasksize, GFP_KERNEL); - if (req_task == NULL) - return -ENOMEM; - if (copy_from_user(req_task, buf, tasksize)) { - kfree(req_task); - return -EFAULT; - } + req_task = memdup_user(buf, tasksize); + if (IS_ERR(req_task)) + return PTR_ERR(req_task); taskout = req_task->out_size; taskin = req_task->in_size;