[libcamera-devel] [PATCH] libcamera: control_serializer: Fix usage of uninitialized variable
Jacopo Mondi
jacopo at jmondi.org
Mon Sep 27 23:21:33 CEST 2021
On Tue, Sep 28, 2021 at 12:19:33AM +0300, Laurent Pinchart wrote:
> 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")
Ups
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Thanks for fixing
Reviewed-by: Jacopo Mondi <jacopo at jmondi.org>
Thanks
j
> ---
> 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