Re: [PATCH 2/7] v4l2-ctrls: Don't initialize array tail when setting a control

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

 



On 01/22/15 15:48, Laurent Pinchart wrote:
> Setting an array control subset isn't allowed by the control framework,
> which returns an error in prepare_ext_ctrls() if the control size
> specified by userspace is smaller than the total size. There is thus no
> need to initialize the array tail to its default value, as the tail will
> always be empty.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>

Acked-by: Hans Verkuil <hans.verkuil@xxxxxxxxx>

Regards,

	Hans

> ---
>  drivers/media/v4l2-core/v4l2-ctrls.c | 4 ----
>  1 file changed, 4 deletions(-)
> 
> diff --git a/drivers/media/v4l2-core/v4l2-ctrls.c b/drivers/media/v4l2-core/v4l2-ctrls.c
> index 301abb7..adac93e 100644
> --- a/drivers/media/v4l2-core/v4l2-ctrls.c
> +++ b/drivers/media/v4l2-core/v4l2-ctrls.c
> @@ -1518,13 +1518,9 @@ static int user_to_ptr(struct v4l2_ext_control *c,
>  
>  	ctrl->is_new = 1;
>  	if (ctrl->is_ptr && !ctrl->is_string) {
> -		unsigned idx;
> -
>  		ret = copy_from_user(ptr.p, c->ptr, c->size) ? -EFAULT : 0;
>  		if (ret || !ctrl->is_array)
>  			return ret;
> -		for (idx = c->size / ctrl->elem_size; idx < ctrl->elems; idx++)
> -			ctrl->type_ops->init(ctrl, idx, ptr);
>  		return 0;
>  	}
>  
> 

--
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