summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <m.chehab@samsung.com>2014-09-03 14:57:30 -0300
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-09-03 17:58:56 -0300
commit0282969190495950564fb0a7e6905881339a1ebc (patch)
treeffbd0b13a98d786c428ea486174bd71751e7e80e /drivers/media/platform
parent93623c87a38533be4d8a636f29e58dbd01d3841b (diff)
downloadlinux-0282969190495950564fb0a7e6905881339a1ebc.tar.bz2
[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>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/vivid/vivid-vid-out.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/media/platform/vivid/vivid-vid-out.c b/drivers/media/platform/vivid/vivid-vid-out.c
index c983461f29d5..8ed9f6d9f505 100644
--- a/drivers/media/platform/vivid/vivid-vid-out.c
+++ b/drivers/media/platform/vivid/vivid-vid-out.c
@@ -897,14 +897,10 @@ int vidioc_s_fmt_vid_out_overlay(struct file *file, void *priv,
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;