]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
[media] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
authorBenoit Parrot <bparrot@ti.com>
Mon, 21 Sep 2015 16:03:21 +0000 (13:03 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Thu, 1 Oct 2015 11:43:41 +0000 (08:43 -0300)
When trying to use v4l2_ctrl_g_ctrl_int64() to retrieve a
V4L2_CTRL_TYPE_INTEGER64 type value the internal helper function
get_ctrl() would prematurely exit because for this control type
the 'is_int' flag is not set. This would result in v4l2_ctrl_g_ctrl_int64
always returning 0.

Also v4l2_ctrl_g_ctrl_int64() is reading and returning the 32bit value
member instead of the 64bit version, so fixing that as well.

This patch extends the condition check to allow the V4L2_CTRL_TYPE_INTEGER64
type to continue processing instead of exiting.

Signed-off-by: Benoit Parrot <bparrot@ti.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Cc: <stable@vger.kernel.org> # for v3.17 and up
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/v4l2-ctrls.c

index d5de70e629898878a54473814a55aae20aabb29b..44521a9da66d265152cde2fa47d08d6edc654dbe 100644 (file)
@@ -2884,7 +2884,7 @@ static int get_ctrl(struct v4l2_ctrl *ctrl, struct v4l2_ext_control *c)
         * cur_to_user() calls below would need to be modified not to access
         * userspace memory when called from get_ctrl().
         */
-       if (!ctrl->is_int)
+       if (!ctrl->is_int && ctrl->type != V4L2_CTRL_TYPE_INTEGER64)
                return -EINVAL;
 
        if (ctrl->flags & V4L2_CTRL_FLAG_WRITE_ONLY)
@@ -2942,9 +2942,9 @@ s64 v4l2_ctrl_g_ctrl_int64(struct v4l2_ctrl *ctrl)
 
        /* It's a driver bug if this happens. */
        WARN_ON(ctrl->is_ptr || ctrl->type != V4L2_CTRL_TYPE_INTEGER64);
-       c.value = 0;
+       c.value64 = 0;
        get_ctrl(ctrl, &c);
-       return c.value;
+       return c.value64;
 }
 EXPORT_SYMBOL(v4l2_ctrl_g_ctrl_int64);