]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: v4l2-ioctl: Clear only per-plane reserved fields
authorThierry Reding <treding@nvidia.com>
Thu, 10 Jan 2019 10:48:39 +0000 (05:48 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 16 Jan 2019 16:10:49 +0000 (11:10 -0500)
Currently the IOCTL code clears everything after the per-plane
bytesperline field in struct v4l2_format. The intent was to only clear
the per-plane reserved fields since there is data in struct v4l2_format
after the per-plane format data that userspace may have filled in.

Fixes: 51abed133e54 ("media: v4l2-ioctl: Zero v4l2_plane_pix_format reserved fields")
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
[hverkuil-cisco@xs4all.nl: fix checkpatch alignment warning]
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/v4l2-core/v4l2-ioctl.c

index 1441a73ce64cf609637c202566756fb98de54c79..ca85c3a9a7b9a519c5d1ecb455755b9db66e9f35 100644 (file)
@@ -1552,7 +1552,8 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
                        break;
                CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
                for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
-                       CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline);
+                       CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+                                         bytesperline);
                return ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg);
        case V4L2_BUF_TYPE_VIDEO_OVERLAY:
                if (unlikely(!ops->vidioc_s_fmt_vid_overlay))
@@ -1582,7 +1583,8 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,
                        break;
                CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
                for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
-                       CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline);
+                       CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+                                         bytesperline);
                return ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg);
        case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
                if (unlikely(!ops->vidioc_s_fmt_vid_out_overlay))
@@ -1649,7 +1651,8 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
                        break;
                CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
                for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
-                       CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline);
+                       CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+                                         bytesperline);
                return ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg);
        case V4L2_BUF_TYPE_VIDEO_OVERLAY:
                if (unlikely(!ops->vidioc_try_fmt_vid_overlay))
@@ -1679,7 +1682,8 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,
                        break;
                CLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);
                for (i = 0; i < p->fmt.pix_mp.num_planes; i++)
-                       CLEAR_AFTER_FIELD(p, fmt.pix_mp.plane_fmt[i].bytesperline);
+                       CLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],
+                                         bytesperline);
                return ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg);
        case V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:
                if (unlikely(!ops->vidioc_try_fmt_vid_out_overlay))