Message ID | 1309351877-32444-6-git-send-email-t.stanislaws@samsung.com (mailing list archive) |
---|---|
State | RFC |
Headers | show |
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@samsung.com> > --- > 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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@samsung.com> --- drivers/media/video/v4l2-common.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)