Re: [PATCH 5/8] v4l: fix v4l_fill_dv_preset_info function

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

 



Em 29-06-2011 09:51, Tomasz Stanislawski escreveu:
> The function fills struct v4l2_dv_enum_preset with appropriate
> preset parameters but it forgets to zero field named reserved.
> This patch fixes this bug.
> 
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@xxxxxxxxxxx>
> ---
>  drivers/media/video/v4l2-common.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
> index 003e648..e7c02e9 100644
> --- a/drivers/media/video/v4l2-common.c
> +++ b/drivers/media/video/v4l2-common.c
> @@ -592,6 +592,8 @@ int v4l_fill_dv_preset_info(u32 preset, struct v4l2_dv_enum_preset *info)
>  	info->width = dv_presets[preset].width;
>  	info->height = dv_presets[preset].height;
>  	strlcpy(info->name, dv_presets[preset].name, sizeof(info->name));
> +	/* assure that reserved fields are zeroed */
> +	memset(info->reserved, 0, sizeof(info->reserved));
>  	return 0;
>  }
>  EXPORT_SYMBOL_GPL(v4l_fill_dv_preset_info);

This patch is not needed, except if you're doing a different logic.
v4l2-ioctl makes sure of cleaning the reserved and write fields from
the structs before passing the syscall to the drivers.

So, if you're filling data from an userspace call, you don't need to
use. If you're instead allocating data, use *zalloc calls.

Cheers,
Mauro
--
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