From: Archit Taneja Date: Mon, 10 Mar 2014 07:19:02 +0000 (-0300) Subject: [media] v4l: ti-vpe: zero out reserved fields in try_fmt X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=92851f1cdbd082eb993847e1c4468f7de08765bb;p=linux.git [media] v4l: ti-vpe: zero out reserved fields in try_fmt Zero out the reserved formats in v4l2_pix_format_mplane and v4l2_plane_pix_format members of the returned v4l2_format pointer when passed through TRY_FMT ioctl. This ensures that the user doesn't interpret the non-zero fields as some data passed by the driver, and ensures compliance. Reviewed-by: Hans Verkuil Signed-off-by: Archit Taneja Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/ti-vpe/vpe.c b/drivers/media/platform/ti-vpe/vpe.c index dfed704ac3752..f42c458aac112 100644 --- a/drivers/media/platform/ti-vpe/vpe.c +++ b/drivers/media/platform/ti-vpe/vpe.c @@ -1480,6 +1480,7 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, } } + memset(pix->reserved, 0, sizeof(pix->reserved)); for (i = 0; i < pix->num_planes; i++) { plane_fmt = &pix->plane_fmt[i]; depth = fmt->vpdma_fmt[i]->depth; @@ -1491,6 +1492,8 @@ static int __vpe_try_fmt(struct vpe_ctx *ctx, struct v4l2_format *f, plane_fmt->sizeimage = (pix->height * pix->width * depth) >> 3; + + memset(plane_fmt->reserved, 0, sizeof(plane_fmt->reserved)); } return 0;