mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-07 23:28:55 +00:00
r128: don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
f1ee616214
commit
3d26759c09
1 changed files with 6 additions and 17 deletions
|
@ -982,25 +982,14 @@ static int r128_cce_dispatch_write_pixels(struct drm_device *dev,
|
||||||
|
|
||||||
xbuf_size = count * sizeof(*x);
|
xbuf_size = count * sizeof(*x);
|
||||||
ybuf_size = count * sizeof(*y);
|
ybuf_size = count * sizeof(*y);
|
||||||
x = kmalloc(xbuf_size, GFP_KERNEL);
|
x = memdup_user(depth->x, xbuf_size);
|
||||||
if (x == NULL)
|
if (IS_ERR(x))
|
||||||
return -ENOMEM;
|
return PTR_ERR(x);
|
||||||
y = kmalloc(ybuf_size, GFP_KERNEL);
|
y = memdup_user(depth->y, ybuf_size);
|
||||||
if (y == NULL) {
|
if (IS_ERR(y)) {
|
||||||
kfree(x);
|
kfree(x);
|
||||||
return -ENOMEM;
|
return PTR_ERR(y);
|
||||||
}
|
}
|
||||||
if (copy_from_user(x, depth->x, xbuf_size)) {
|
|
||||||
kfree(x);
|
|
||||||
kfree(y);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
if (copy_from_user(y, depth->y, xbuf_size)) {
|
|
||||||
kfree(x);
|
|
||||||
kfree(y);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
|
|
||||||
buffer_size = depth->n * sizeof(u32);
|
buffer_size = depth->n * sizeof(u32);
|
||||||
buffer = memdup_user(depth->buffer, buffer_size);
|
buffer = memdup_user(depth->buffer, buffer_size);
|
||||||
if (IS_ERR(buffer)) {
|
if (IS_ERR(buffer)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue