From patchwork Thu Feb 18 13:47:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 11335 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 591AEBD1F6 for ; Thu, 18 Feb 2021 13:47:59 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D06DC689BC; Thu, 18 Feb 2021 14:47:58 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Y8nOhGFh"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EB5756835F for ; Thu, 18 Feb 2021 14:47:56 +0100 (CET) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6B9AE3E7; Thu, 18 Feb 2021 14:47:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1613656076; bh=P2hyrNAromnPRcOh45XrSuceNLEM5KUxa1nOxk012IY=; h=From:To:Cc:Subject:Date:From; b=Y8nOhGFhs71Fo5xAOVuI/ceyPIZHbnyP4tWV2f1o/j0n1yBJLphtSOu4z78VE8Lwn WMjE4uXA53c/28LRrz2wbvn4A7hTqbK2V5J/yJxqZ/Q0ZiCRGzJGNTHOWozPHVHKUC 7V40VhPeZH45n5/xCEeqF7H4Zt/FZGYt3mAtnE5s= From: Kieran Bingham To: libcamera devel Date: Thu, 18 Feb 2021 13:47:52 +0000 Message-Id: <20210218134752.1303582-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: pipeline: ipu3: Prevent unintialised memory use X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 Acked-by: Jacopo Mondi Reviewed-by: Paul Elder --- 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)