[media] vivid-vid-out: use memdup_user()
Instead of allocating and coping from __user, do it using one atomic call. That makes the code simpler. Found by coccinelle. Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
This commit is contained in:
parent
93623c87a3
commit
0282969190
1 changed files with 3 additions and 7 deletions
|
@ -897,14 +897,10 @@ int vidioc_s_fmt_vid_out_overlay(struct file *file, void *priv,
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
if (win->bitmap) {
|
if (win->bitmap) {
|
||||||
new_bitmap = kzalloc(bitmap_size, GFP_KERNEL);
|
new_bitmap = memdup_user(win->bitmap, bitmap_size);
|
||||||
|
|
||||||
if (new_bitmap == NULL)
|
if (IS_ERR(new_bitmap))
|
||||||
return -ENOMEM;
|
return PTR_ERR(new_bitmap);
|
||||||
if (copy_from_user(new_bitmap, win->bitmap, bitmap_size)) {
|
|
||||||
kfree(new_bitmap);
|
|
||||||
return -EFAULT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->overlay_out_top = win->w.top;
|
dev->overlay_out_top = win->w.top;
|
||||||
|
|
Loading…
Add table
Reference in a new issue