Skip to content

Commit

Permalink
[media] v4l: ti-vpe: zero out reserved fields in try_fmt
Browse files Browse the repository at this point in the history
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 <hans.verkuil@cisco.com>
Signed-off-by: Archit Taneja <archit@ti.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
  • Loading branch information
Archit Taneja authored and Mauro Carvalho Chehab committed Apr 7, 2014
1 parent 67fb87e commit 92851f1
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/media/platform/ti-vpe/vpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down

0 comments on commit 92851f1

Please sign in to comment.