Commit 8ed6010d authored by Al Viro's avatar Al Viro

mtip32xx: don't open-code memdup_user()

[folded a fix by Dan Carpenter]
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 793b796e
...@@ -2029,13 +2029,10 @@ static int exec_drive_taskfile(struct driver_data *dd, ...@@ -2029,13 +2029,10 @@ static int exec_drive_taskfile(struct driver_data *dd,
} }
if (taskout) { if (taskout) {
outbuf = kzalloc(taskout, GFP_KERNEL); outbuf = memdup_user(buf + outtotal, taskout);
if (outbuf == NULL) { if (IS_ERR(outbuf)) {
err = -ENOMEM; err = PTR_ERR(outbuf);
goto abort; outbuf = NULL;
}
if (copy_from_user(outbuf, buf + outtotal, taskout)) {
err = -EFAULT;
goto abort; goto abort;
} }
outbuf_dma = pci_map_single(dd->pdev, outbuf_dma = pci_map_single(dd->pdev,
...@@ -2050,14 +2047,10 @@ static int exec_drive_taskfile(struct driver_data *dd, ...@@ -2050,14 +2047,10 @@ static int exec_drive_taskfile(struct driver_data *dd,
} }
if (taskin) { if (taskin) {
inbuf = kzalloc(taskin, GFP_KERNEL); inbuf = memdup_user(buf + intotal, taskin);
if (inbuf == NULL) { if (IS_ERR(inbuf)) {
err = -ENOMEM; err = PTR_ERR(inbuf);
goto abort; inbuf = NULL;
}
if (copy_from_user(inbuf, buf + intotal, taskin)) {
err = -EFAULT;
goto abort; goto abort;
} }
inbuf_dma = pci_map_single(dd->pdev, inbuf_dma = pci_map_single(dd->pdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment