* [Patch v2] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
@ 2015-09-21 16:03 Benoit Parrot
2015-09-22 9:50 ` Sakari Ailus
0 siblings, 1 reply; 2+ messages in thread
From: Benoit Parrot @ 2015-09-21 16:03 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media, Benoit Parrot
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 exits 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 extend the condition check to allow V4L2_CTRL_TYPE_INTEGER64
type to continue processing instead of exiting.
Signed-off-by: Benoit Parrot <bparrot@ti.com>
---
drivers/media/v4l2-core/v4l2-ctrls.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
index b6b7dcc1b77d..6f1a8a6cc149 100644
--- a/drivers/media/v4l2-core/v4l2-ctrls.c
+++ b/drivers/media/v4l2-core/v4l2-ctrls.c
@@ -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);
--
1.8.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch v2] media: v4l2-ctrls: Fix 64bit support in get_ctrl()
2015-09-21 16:03 [Patch v2] media: v4l2-ctrls: Fix 64bit support in get_ctrl() Benoit Parrot
@ 2015-09-22 9:50 ` Sakari Ailus
0 siblings, 0 replies; 2+ messages in thread
From: Sakari Ailus @ 2015-09-22 9:50 UTC (permalink / raw)
To: Benoit Parrot; +Cc: Hans Verkuil, linux-media
On Mon, Sep 21, 2015 at 11:03:21AM -0500, Benoit Parrot wrote:
> 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 exits 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 extend the condition check to allow V4L2_CTRL_TYPE_INTEGER64
> type to continue processing instead of exiting.
>
> Signed-off-by: Benoit Parrot <bparrot@ti.com>
Thanks!
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
e-mail: sakari.ailus@iki.fi XMPP: sailus@retiisi.org.uk
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-09-22 9:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-21 16:03 [Patch v2] media: v4l2-ctrls: Fix 64bit support in get_ctrl() Benoit Parrot
2015-09-22 9:50 ` Sakari Ailus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).