[libcamera-devel] [PATCH] libcamera: pipeline: ipu3: Prevent unintialised memory use

Kieran Bingham kieran.bingham at ideasonboard.com
Thu Feb 18 14:47:52 CET 2021


The call to setFormat uses uninitialised data, which whilst
not necessary a fault while setting, could cause unwanted effects.

It is also trapped and reported by valgrind.

Initialise the  V4L2SubdeviceFormat structure correctly before use.

Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
---
 src/libcamera/pipeline/ipu3/ipu3.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
index 3e6b88af4188..e2353e890e0f 100644
--- a/src/libcamera/pipeline/ipu3/ipu3.cpp
+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
@@ -846,7 +846,7 @@ int PipelineHandlerIPU3::initControls(IPU3CameraData *data)
 	 */
 
 	/* Re-fetch the sensor info updated to use the largest resolution. */
-	V4L2SubdeviceFormat sensorFormat;
+	V4L2SubdeviceFormat sensorFormat = {};
 	sensorFormat.size = sensor->resolution();
 	ret = sensor->setFormat(&sensorFormat);
 	if (ret)
-- 
2.25.1



More information about the libcamera-devel mailing list