[libcamera-devel] [PATCH] libcamera: control_serializer: Fix usage of uninitialized variable
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Mon Sep 27 23:19:33 CEST 2021
The idMap variable may be used uninitialized in the
ControlSerializer::deserialize<ControlList>() function as reported by
gcc 11:
../../src/libcamera/control_serializer.cpp: In member function ‘T libcamera::ControlSerializer::deserialize(libcamera::ByteStreamBuffer&) [with T = libcamera::ControlList]’:
../../src/libcamera/control_serializer.cpp:609:33: error: ‘idMap’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
609 | ControlList ctrls(*idMap);
|
This is due to a missing default case in a switch/case. Fix it by adding
the default case.
Fixes: 6b1404fc4836 ("libcamera: control_serializer: Fix usage of uninitialized variable")
Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
src/libcamera/control_serializer.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/libcamera/control_serializer.cpp b/src/libcamera/control_serializer.cpp
index 77b77448d61d..e87d23625ed2 100644
--- a/src/libcamera/control_serializer.cpp
+++ b/src/libcamera/control_serializer.cpp
@@ -594,6 +594,7 @@ ControlList ControlSerializer::deserialize<ControlList>(ByteStreamBuffer &buffer
break;
case IPA_CONTROL_ID_MAP_V4L2:
+ default:
LOG(Serializer, Fatal)
<< "A list of V4L2 controls requires an ControlInfoMap";
return {};
base-commit: 957c5d534b42e05520de82f27b2204fa864d511a
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list