linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hans Verkuil <hverkuil@xs4all.nl>
To: linux-media@vger.kernel.org
Cc: Hans Verkuil <hans.verkuil@cisco.com>
Subject: [PATCHv2 05/15] v4l2-subdev: clear reserved fields
Date: Thu,  8 Feb 2018 09:36:45 +0100	[thread overview]
Message-ID: <20180208083655.32248-6-hverkuil@xs4all.nl> (raw)
In-Reply-To: <20180208083655.32248-1-hverkuil@xs4all.nl>

Clear the reserved fields for these ioctls according to the specification:

VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
VIDIOC_SUBDEV_ENUM_FRAME_SIZE
VIDIOC_SUBDEV_ENUM_MBUS_CODE
VIDIOC_SUBDEV_G_CROP, VIDIOC_SUBDEV_S_CROP
VIDIOC_SUBDEV_G_FMT, VIDIOC_SUBDEV_S_FMT
VIDIOC_SUBDEV_G_FRAME_INTERVAL, VIDIOC_SUBDEV_S_FRAME_INTERVAL
VIDIOC_SUBDEV_G_SELECTION, VIDIOC_SUBDEV_S_SELECTION

Found with v4l2-compliance.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/v4l2-core/v4l2-subdev.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c
index be7a19272614..6cabfa32d2ed 100644
--- a/drivers/media/v4l2-core/v4l2-subdev.c
+++ b/drivers/media/v4l2-core/v4l2-subdev.c
@@ -276,6 +276,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (rval)
 			return rval;
 
+		memset(format->reserved, 0, sizeof(format->reserved));
+		memset(format->format.reserved, 0, sizeof(format->format.reserved));
 		return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->pad, format);
 	}
 
@@ -286,6 +288,8 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (rval)
 			return rval;
 
+		memset(format->reserved, 0, sizeof(format->reserved));
+		memset(format->format.reserved, 0, sizeof(format->format.reserved));
 		return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->pad, format);
 	}
 
@@ -293,6 +297,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		struct v4l2_subdev_crop *crop = arg;
 		struct v4l2_subdev_selection sel;
 
+		memset(crop->reserved, 0, sizeof(crop->reserved));
 		rval = check_crop(sd, crop);
 		if (rval)
 			return rval;
@@ -318,6 +323,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (rval)
 			return rval;
 
+		memset(crop->reserved, 0, sizeof(crop->reserved));
 		memset(&sel, 0, sizeof(sel));
 		sel.which = crop->which;
 		sel.pad = crop->pad;
@@ -342,6 +348,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (code->pad >= sd->entity.num_pads)
 			return -EINVAL;
 
+		memset(code->reserved, 0, sizeof(code->reserved));
 		return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->pad,
 					code);
 	}
@@ -356,6 +363,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (fse->pad >= sd->entity.num_pads)
 			return -EINVAL;
 
+		memset(fse->reserved, 0, sizeof(fse->reserved));
 		return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->pad,
 					fse);
 	}
@@ -366,6 +374,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (fi->pad >= sd->entity.num_pads)
 			return -EINVAL;
 
+		memset(fi->reserved, 0, sizeof(fi->reserved));
 		return v4l2_subdev_call(sd, video, g_frame_interval, arg);
 	}
 
@@ -375,6 +384,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (fi->pad >= sd->entity.num_pads)
 			return -EINVAL;
 
+		memset(fi->reserved, 0, sizeof(fi->reserved));
 		return v4l2_subdev_call(sd, video, s_frame_interval, arg);
 	}
 
@@ -388,6 +398,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (fie->pad >= sd->entity.num_pads)
 			return -EINVAL;
 
+		memset(fie->reserved, 0, sizeof(fie->reserved));
 		return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->pad,
 					fie);
 	}
@@ -399,6 +410,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (rval)
 			return rval;
 
+		memset(sel->reserved, 0, sizeof(sel->reserved));
 		return v4l2_subdev_call(
 			sd, pad, get_selection, subdev_fh->pad, sel);
 	}
@@ -410,6 +422,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 		if (rval)
 			return rval;
 
+		memset(sel->reserved, 0, sizeof(sel->reserved));
 		return v4l2_subdev_call(
 			sd, pad, set_selection, subdev_fh->pad, sel);
 	}
-- 
2.15.1

  parent reply	other threads:[~2018-02-08  8:37 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-08  8:36 [PATCHv2 00/15] Media Controller compliance fixes Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 01/15] vimc: fix control event handling Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 02/15] vimc: use correct subdev functions Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 03/15] v4l2-ioctl.c: fix VIDIOC_DV_TIMINGS_CAP: don't clear pad Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 04/15] v4l2-subdev: without controls return -ENOTTY Hans Verkuil
2018-02-09 11:46   ` Sakari Ailus
2018-02-09 11:56     ` Hans Verkuil
2018-02-09 12:38       ` Sakari Ailus
2018-02-09 12:48         ` Hans Verkuil
2018-02-09 13:09           ` Sakari Ailus
2018-02-09 13:14             ` Hans Verkuil
2018-02-08  8:36 ` Hans Verkuil [this message]
2018-02-08  8:36 ` [PATCHv2 06/15] v4l2-subdev: implement VIDIOC_DBG_G_CHIP_INFO ioctl Hans Verkuil
2018-02-09 12:01   ` Sakari Ailus
2018-02-09 12:18     ` Hans Verkuil
2018-02-09 12:44       ` Sakari Ailus
2018-02-09 12:58         ` Laurent Pinchart
2018-02-09 13:00         ` Hans Verkuil
2018-02-09 13:04           ` Laurent Pinchart
2018-02-09 13:13             ` Hans Verkuil
2018-02-09 13:21               ` Laurent Pinchart
2018-02-09 13:36                 ` Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 07/15] subdev-formats.rst: fix incorrect types Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 08/15] media-ioc-g-topology.rst: fix interface-to-entity link description Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 09/15] media-types.rst: fix type, small improvements Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 10/15] media: media-types.rst: fix typo Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 11/15] media-device.c: zero reserved field Hans Verkuil
2018-02-09 12:17   ` Sakari Ailus
2018-02-09 12:20     ` Hans Verkuil
2018-02-09 12:46       ` Sakari Ailus
2018-02-09 12:52         ` Hans Verkuil
2018-02-09 13:04           ` Sakari Ailus
2018-02-09 13:27             ` Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 12/15] media.h: fix confusing typo in comment Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 13/15] media: document and zero reservedX fields in media_v2_topology Hans Verkuil
2018-02-09 12:21   ` Sakari Ailus
2018-02-08  8:36 ` [PATCHv2 14/15] media-ioc-enum-entities/links.rst: document reserved fields Hans Verkuil
2018-02-08  8:36 ` [PATCHv2 15/15] media.h: reorganize header to make it easier to understand Hans Verkuil
2018-02-09 12:48 ` [PATCHv2 00/15] Media Controller compliance fixes Sakari Ailus
2018-02-09 12:49   ` Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180208083655.32248-6-hverkuil@xs4all.nl \
    --to=hverkuil@xs4all.nl \
    --cc=hans.verkuil@cisco.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).