Commit d01a1c30 authored by Laurent Pinchart's avatar Laurent Pinchart Committed by Mauro Carvalho Chehab

media: imx: imx7-media-csi: Zero format struct before calling .get_fmt()

The v4l2_subdev_format structure passed to the .get_fmt() subdev
operation in imx7_csi_video_validate_fmt() isn't zeroed, which can cause
undefined behaviour. Fix it.
Signed-off-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Adam Ford <aford173@gmail.com> #imx8mm-beacon-kit
Acked-by: default avatarRui Miguel Silva <rmfrfs@gmail.com>
Tested-by: default avatarMartin Kepplinger <martin.kepplinger@puri.sm>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 2c117550
...@@ -1412,13 +1412,14 @@ static void imx7_csi_video_buf_queue(struct vb2_buffer *vb) ...@@ -1412,13 +1412,14 @@ static void imx7_csi_video_buf_queue(struct vb2_buffer *vb)
static int imx7_csi_video_validate_fmt(struct imx7_csi *csi) static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)
{ {
struct v4l2_subdev_format fmt_src; struct v4l2_subdev_format fmt_src = {
.pad = IMX7_CSI_PAD_SRC,
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
const struct imx7_csi_pixfmt *cc; const struct imx7_csi_pixfmt *cc;
int ret; int ret;
/* Retrieve the media bus format on the source subdev. */ /* Retrieve the media bus format on the source subdev. */
fmt_src.pad = IMX7_CSI_PAD_SRC;
fmt_src.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(&csi->sd, pad, get_fmt, NULL, &fmt_src); ret = v4l2_subdev_call(&csi->sd, pad, get_fmt, NULL, &fmt_src);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment