libcamera/src
Laurent Pinchart b84896c128 libcamera: pipeline: ipu3: Fix incorrect bdsHeight calculation
When compiling with optimization, gcc 9 and newer throw an unitialized
variable warning:

../../src/libcamera/pipeline/ipu3/imgu.cpp: In function ‘void libcamera::{anonymous}::calculateBDSHeight(libcamera::ImgUDevice::Pipe*, const libcamera::Size&, const libcamera::Size&, unsigned int, float)’:
../../src/libcamera/pipeline/ipu3/imgu.cpp:172:17: error: ‘bdsHeight’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  172 |    unsigned int bdsIntHeight = static_cast<unsigned int>(bdsHeight);

Neither clang not gcc versions older than 9 complain. This seems to be
a false positive.

However, there's an obvious error in the code. The second while () loop
in the first part of calculateBDSHeight() modifies the bdsHeight
variable set by the first loop even if the second loop doesn't find a
suitable height. This can result in an incorrect bdsHeight value. Fix
this, which also gets rid of the compiler warning.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Tested-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
Reviewed-by: Jean-Michel Hautbois <jeanmichel.hautbois@ideasonboard.com>
2021-06-01 03:18:57 +03:00
..
android android: Don't rely on indirect inclusion of unistd.h 2021-05-31 19:26:59 +03:00
cam cam: Implement OptMetadata 2021-05-06 15:09:42 +02:00
gstreamer gst: Fix compilation warning with GLib >= 2.62 2021-05-31 23:18:25 +03:00
ipa ipa: ipu3: Set output frame duration metadata 2021-05-27 17:05:29 +09:00
lc-compliance lc-compliance: simple_capture: Handle unsupported roles 2021-04-21 20:05:21 +02:00
libcamera libcamera: pipeline: ipu3: Fix incorrect bdsHeight calculation 2021-06-01 03:18:57 +03:00
qcam meson: Summarize which applications and adaptation layers are built 2021-03-28 01:47:26 +02:00
v4l2 v4l2: Replace manual loop counters with utils::enumerate() 2021-05-18 14:45:29 +03:00
meson.build src: meson: Define system paths 2021-04-30 11:53:09 +01:00