summaryrefslogtreecommitdiff
path: root/src/android/mm
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-30 20:03:28 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2021-08-31 15:18:43 +0300
commit1c877bd8684d8e7743310d0b124ce0f9bf3aee79 (patch)
tree1bf52a19389081bf36c54651d11818de7f94b033 /src/android/mm
parent88009711be33903672e45b89cf5c9d3fc5761724 (diff)
android: generic_camera_buffer: Fix bufferLength_ initialization
The bufferLength_ member variabled is checked to have a positive value before being used, to catch usage before the variable is set. The variable is initialized to zero at construction time, which renders the checks useless. Fix this by initializing the variable to -1 at construction time. Fixes: c5e2ed7806be ("android: camera_buffer: Map buffer in the first plane() call") Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Hirokazu Honda <hiroh@chromium.org> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src/android/mm')
-rw-r--r--src/android/mm/generic_camera_buffer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/android/mm/generic_camera_buffer.cpp b/src/android/mm/generic_camera_buffer.cpp
index a41ae2c9..22efc4d4 100644
--- a/src/android/mm/generic_camera_buffer.cpp
+++ b/src/android/mm/generic_camera_buffer.cpp
@@ -60,7 +60,7 @@ CameraBuffer::Private::Private([[maybe_unused]] CameraBuffer *cameraBuffer,
buffer_handle_t camera3Buffer,
libcamera::PixelFormat pixelFormat,
const libcamera::Size &size, int flags)
- : fd_(-1), flags_(flags), bufferLength_(0), mapped_(false)
+ : fd_(-1), flags_(flags), bufferLength_(-1), mapped_(false)
{
error_ = 0;