diff options
author | Markus Elfring <elfring@users.sourceforge.net> | 2016-08-19 05:50:05 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@s-opensource.com> | 2016-11-23 20:06:41 -0200 |
commit | 4cc5bed1caeb6d40f2f41c4c5eb83368691fbffb (patch) | |
tree | 04a1a1351c4d16271781b8363f9c183bb14e98d0 /drivers | |
parent | eb165a20dfbe8b82e82b671e9941c4ad9f34388d (diff) | |
download | linux-stable-4cc5bed1caeb6d40f2f41c4c5eb83368691fbffb.tar.gz linux-stable-4cc5bed1caeb6d40f2f41c4c5eb83368691fbffb.tar.bz2 linux-stable-4cc5bed1caeb6d40f2f41c4c5eb83368691fbffb.zip |
[media] uvcvideo: Use memdup_user() rather than duplicating its implementation
Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/usb/uvc/uvc_v4l2.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 05eed4be25df..a7e12fd20adc 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -70,14 +70,9 @@ static int uvc_ioctl_ctrl_map(struct uvc_video_chain *chain, } size = xmap->menu_count * sizeof(*map->menu_info); - map->menu_info = kmalloc(size, GFP_KERNEL); - if (map->menu_info == NULL) { - ret = -ENOMEM; - goto done; - } - - if (copy_from_user(map->menu_info, xmap->menu_info, size)) { - ret = -EFAULT; + map->menu_info = memdup_user(xmap->menu_info, size); + if (IS_ERR(map->menu_info)) { + ret = PTR_ERR(map->menu_info); goto done; } |