[libcamera-devel] [PATCH v2 0/3] libcamera: Fix uninitialized use of V4L2DeviceFormat members

Laurent Pinchart laurent.pinchart at ideasonboard.com
Wed Nov 4 08:48:38 CET 2020


Hello,

This small series fixes uninitialized uses of planes and planesCount
members of the V4L2DeviceFormat class. It supersedes the following two
patches (hence the v2):

[PATCH 1/2] libcamera: v4l2_videodevice: Check plane count when setting format
[PATCH 2/2] libcamera: pipeline: simple: Initialize V4L2DeviceFormat before use

The approach taken here is different, instead of adding missing
initialization in the users of the class, and starting a game of
whack-a-mole, patch 1/3 adds initializers in the class itself. Patch 2/3
hasn't changed compared to 1/2 of v1, and patch 3/3 drops now unneeded
explicit initialization.

The series has been tested by removing patch 1/3, noticing assertion
failures in unit tests, and verifying that patch 1/3 fixes the issue.

Laurent Pinchart (3):
  libcamera: v4l2_videodevice: Zero-initialize planes in
    V4L2DeviceFormat
  libcamera: v4l2_videodevice: Check plane count when setting format
  libcamera: Drop unnecessary explicit initialization of
    V4L2DeviceFormat

 include/libcamera/internal/v4l2_videodevice.h      | 13 ++++++++-----
 src/libcamera/pipeline/ipu3/ipu3.cpp               |  2 +-
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  6 +++---
 src/libcamera/pipeline/rkisp1/rkisp1.cpp           |  4 ++--
 src/libcamera/pipeline/rkisp1/rkisp1_path.cpp      |  4 ++--
 src/libcamera/pipeline/simple/converter.cpp        |  2 +-
 src/libcamera/pipeline/simple/simple.cpp           |  4 ++--
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  4 ++--
 src/libcamera/pipeline/vimc/vimc.cpp               |  4 ++--
 src/libcamera/v4l2_videodevice.cpp                 | 11 +++++++++++
 10 files changed, 34 insertions(+), 20 deletions(-)

-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list