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>
return ret;
if (win->bitmap) {
- new_bitmap = kzalloc(bitmap_size, GFP_KERNEL);
+ new_bitmap = memdup_user(win->bitmap, bitmap_size);
- if (new_bitmap == NULL)
- return -ENOMEM;
- if (copy_from_user(new_bitmap, win->bitmap, bitmap_size)) {
- kfree(new_bitmap);
- return -EFAULT;
- }
+ if (IS_ERR(new_bitmap))
+ return PTR_ERR(new_bitmap);
}
dev->overlay_out_top = win->w.top;