Re: [RFCv2 PATCH 09/21] v4l2-ctrls: rewrite copy routines to operate on union v4l2_ctrl_ptr.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Hans,

On Mon, Jan 20, 2014 at 01:46:02PM +0100, Hans Verkuil wrote:
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 9f97af4..c0507ed 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1266,48 +1266,64 @@ static const struct v4l2_ctrl_type_ops std_type_ops = {
>  	.validate = std_validate,
>  };
>  
> -/* Helper function: copy the current control value back to the caller */
> -static int cur_to_user(struct v4l2_ext_control *c,
> -		       struct v4l2_ctrl *ctrl)
> +/* Helper function: copy the given control value back to the caller */
> +static int ptr_to_user(struct v4l2_ext_control *c,
> +		       struct v4l2_ctrl *ctrl,
> +		       union v4l2_ctrl_ptr ptr)
>  {
>  	u32 len;
>  
>  	if (ctrl->is_ptr && !ctrl->is_string)
> -		return copy_to_user(c->p, ctrl->cur.p, ctrl->elem_size);
> +		return copy_to_user(c->p, ptr.p, ctrl->elem_size);

Not a fault of this patch, but this is wrong: copy_to_user() returns the
bytes not copied. That should probably be fixed separately before this
patch. I can submit one.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@xxxxxx	XMPP: sailus@xxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux