mbox series

[0/3] media: Zero-initialize structures passed to subdev pad ops

Message ID 20230215165021.6628-1-laurent.pinchart@ideasonboard.com
Headers show
Series media: Zero-initialize structures passed to subdev pad ops | expand

Message

Laurent Pinchart Feb. 15, 2023, 4:50 p.m. UTC
Hello,

This patch series fixes a (surprisingly large) number of drivers that
don't zero-initialize structures passed to subdev pad operations.

The rationale is explained in patch 1/3, which fixes the issue: while
this doesn't cause any immediate problem, it leaves reserved fields
uninitialized, and any future change of in-kernel APIs that make use of
some of the reserved fields may introduce hard to catch breakages.

Patches 2/3 and 3/3 are not strictly required to fix the problem, but
they address coding style consistency issues that bothered me when
developing 1/3.

Laurent Pinchart (3):
  media: Zero-initialize all structures passed to subdev pad operations
  media: Prefer designated initializers over memset for subdev pad ops
  media: USe designated initializers for all subdev pad ops

 drivers/media/pci/cobalt/cobalt-v4l2.c        | 21 ++++++----
 drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |  1 +
 .../platform/microchip/microchip-isc-base.c   |  5 ++-
 .../media/platform/qcom/camss/camss-video.c   |  5 ++-
 .../media/platform/renesas/vsp1/vsp1_drm.c    | 23 ++++++-----
 .../media/platform/renesas/vsp1/vsp1_entity.c | 11 +++--
 .../media/platform/renesas/vsp1/vsp1_video.c  |  5 ++-
 .../samsung/exynos4-is/fimc-capture.c         | 18 +++++----
 .../samsung/exynos4-is/fimc-isp-video.c       | 10 +++--
 .../platform/samsung/exynos4-is/fimc-lite.c   |  9 +++--
 .../samsung/s3c-camif/camif-capture.c         |  5 ++-
 .../platform/samsung/s3c-camif/camif-core.c   |  5 ++-
 .../media/platform/ti/am437x/am437x-vpfe.c    | 35 ++++++++--------
 drivers/media/platform/ti/cal/cal-video.c     | 37 +++++++++--------
 drivers/media/platform/ti/omap3isp/ispccdc.c  |  5 ++-
 drivers/media/platform/ti/omap3isp/ispvideo.c | 20 ++++++----
 drivers/media/platform/xilinx/xilinx-dma.c    |  5 ++-
 drivers/media/test-drivers/vimc/vimc-common.c |  8 ++--
 drivers/media/usb/dvb-usb/cxusb-analog.c      | 14 +++----
 .../media/deprecated/atmel/atmel-isc-base.c   |  5 ++-
 drivers/staging/media/imx/imx-media-capture.c | 40 ++++++++++---------
 drivers/staging/media/imx/imx-media-utils.c   |  8 ++--
 drivers/staging/media/omap4iss/iss_video.c    | 16 ++++----
 drivers/staging/media/tegra-video/vi.c        | 10 +++--
 24 files changed, 182 insertions(+), 139 deletions(-)


base-commit: 83e0f265aa8d0e37cc8e15d318b64da0ec03ff41

Comments

Tomi Valkeinen Feb. 28, 2023, 3:52 p.m. UTC | #1
On 15/02/2023 18:50, Laurent Pinchart wrote:
> Hello,
> 
> This patch series fixes a (surprisingly large) number of drivers that
> don't zero-initialize structures passed to subdev pad operations.
> 
> The rationale is explained in patch 1/3, which fixes the issue: while
> this doesn't cause any immediate problem, it leaves reserved fields
> uninitialized, and any future change of in-kernel APIs that make use of
> some of the reserved fields may introduce hard to catch breakages.
> 
> Patches 2/3 and 3/3 are not strictly required to fix the problem, but
> they address coding style consistency issues that bothered me when
> developing 1/3.
> 
> Laurent Pinchart (3):
>    media: Zero-initialize all structures passed to subdev pad operations
>    media: Prefer designated initializers over memset for subdev pad ops
>    media: USe designated initializers for all subdev pad ops

For the three patches:

Reviewed-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

  Tomi
Kieran Bingham Feb. 28, 2023, 4:41 p.m. UTC | #2
Hi Laurent,

Quoting Laurent Pinchart (2023-02-15 16:50:18)
> Hello,
> 
> This patch series fixes a (surprisingly large) number of drivers that
> don't zero-initialize structures passed to subdev pad operations.
> 
> The rationale is explained in patch 1/3, which fixes the issue: while
> this doesn't cause any immediate problem, it leaves reserved fields
> uninitialized, and any future change of in-kernel APIs that make use of
> some of the reserved fields may introduce hard to catch breakages.
> 
> Patches 2/3 and 3/3 are not strictly required to fix the problem, but
> they address coding style consistency issues that bothered me when
> developing 1/3.

For the series,

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> 
> Laurent Pinchart (3):
>   media: Zero-initialize all structures passed to subdev pad operations
>   media: Prefer designated initializers over memset for subdev pad ops
>   media: USe designated initializers for all subdev pad ops
> 
>  drivers/media/pci/cobalt/cobalt-v4l2.c        | 21 ++++++----
>  drivers/media/pci/intel/ipu3/ipu3-cio2-main.c |  1 +
>  .../platform/microchip/microchip-isc-base.c   |  5 ++-
>  .../media/platform/qcom/camss/camss-video.c   |  5 ++-
>  .../media/platform/renesas/vsp1/vsp1_drm.c    | 23 ++++++-----
>  .../media/platform/renesas/vsp1/vsp1_entity.c | 11 +++--
>  .../media/platform/renesas/vsp1/vsp1_video.c  |  5 ++-
>  .../samsung/exynos4-is/fimc-capture.c         | 18 +++++----
>  .../samsung/exynos4-is/fimc-isp-video.c       | 10 +++--
>  .../platform/samsung/exynos4-is/fimc-lite.c   |  9 +++--
>  .../samsung/s3c-camif/camif-capture.c         |  5 ++-
>  .../platform/samsung/s3c-camif/camif-core.c   |  5 ++-
>  .../media/platform/ti/am437x/am437x-vpfe.c    | 35 ++++++++--------
>  drivers/media/platform/ti/cal/cal-video.c     | 37 +++++++++--------
>  drivers/media/platform/ti/omap3isp/ispccdc.c  |  5 ++-
>  drivers/media/platform/ti/omap3isp/ispvideo.c | 20 ++++++----
>  drivers/media/platform/xilinx/xilinx-dma.c    |  5 ++-
>  drivers/media/test-drivers/vimc/vimc-common.c |  8 ++--
>  drivers/media/usb/dvb-usb/cxusb-analog.c      | 14 +++----
>  .../media/deprecated/atmel/atmel-isc-base.c   |  5 ++-
>  drivers/staging/media/imx/imx-media-capture.c | 40 ++++++++++---------
>  drivers/staging/media/imx/imx-media-utils.c   |  8 ++--
>  drivers/staging/media/omap4iss/iss_video.c    | 16 ++++----
>  drivers/staging/media/tegra-video/vi.c        | 10 +++--
>  24 files changed, 182 insertions(+), 139 deletions(-)
> 
> 
> base-commit: 83e0f265aa8d0e37cc8e15d318b64da0ec03ff41
> -- 
> Regards,
> 
> Laurent Pinchart
>