]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: v4l: Memset argument to 0 before calling get_mbus_config pad op
authorSakari Ailus <sakari.ailus@linux.intel.com>
Mon, 16 Dec 2024 08:48:49 +0000 (10:48 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Jun 2025 12:37:04 +0000 (14:37 +0200)
[ Upstream commit 91d6a99acfa5ce9f95ede775074b80f7193bd717 ]

Memset the config argument to get_mbus_config V4L2 sub-device pad
operation to zero before calling the operation. This ensures the callers
don't need to bother with it nor the implementations need to set all
fields that may not be relevant to them.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/v4l2-core/v4l2-subdev.c
include/media/v4l2-subdev.h

index fbf0dcb313c820cd0d86d1b9a873767ea2b4beb1..67d3e6511a1466c146d3f64c1e3edf4e91913ae6 100644 (file)
@@ -312,6 +312,8 @@ static int call_enum_dv_timings(struct v4l2_subdev *sd,
 static int call_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad,
                                struct v4l2_mbus_config *config)
 {
+       memset(config, 0, sizeof(*config));
+
        return check_pad(sd, pad) ? :
               sd->ops->pad->get_mbus_config(sd, pad, config);
 }
index 73150520c02d44c0f0f7e30a41c5a64734134e69..ffc6d122f91e5703d94a23c8fdf5f2ff6f9fe2d5 100644 (file)
@@ -676,7 +676,9 @@ struct v4l2_subdev_pad_config {
  *                  possible configuration from the remote end, likely calling
  *                  this operation as close as possible to stream on time. The
  *                  operation shall fail if the pad index it has been called on
- *                  is not valid or in case of unrecoverable failures.
+ *                  is not valid or in case of unrecoverable failures. The
+ *                  config argument has been memset to 0 just before calling
+ *                  the op.
  *
  * @set_mbus_config: set the media bus configuration of a remote sub-device.
  *                  This operations is intended to allow, in combination with