From patchwork Thu Jul 18 05:06:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 1717 Return-Path: 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 3287960C00 for ; Thu, 18 Jul 2019 07:06:22 +0200 (CEST) Received: from localhost.localdomain (cpc89242-aztw30-2-0-cust488.18-1.cable.virginm.net [86.31.129.233]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9AEB431C; Thu, 18 Jul 2019 07:06:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1563426381; bh=7UlcKjG4dyMPQwtYDjim2DusAjF5Qq0orp35UVyKOKg=; h=From:To:Cc:Subject:Date:From; b=vDCYptfxK2/MvPcaK5pxIWx4F3F2EkWmBoGD6xROflSskZ9D8CRj1ZT2dvN7+EPWK 0l0FLT5ShVUtAM54vJIZJzZdXndQHAeTvnVuKr8InUm3gmhlAIxYZzzcIOWGnUQd1x cc+9cQfHbkJWDyRUtylwbeaDP0zieITBdC4X7yOg= From: Kieran Bingham To: LibCamera Devel Date: Thu, 18 Jul 2019 06:06:17 +0100 Message-Id: <20190718050617.29455-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] libcamera: ipa_module: prevent uninitialised access X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jul 2019 05:06:22 -0000 The IPAModule::loadIPAModuleInfo() function includes a *data pointer which is used as a null-pointer comparison in the error path with a conditional statement of "if (ret || !data)". The data variable is not initialised, and a single error path evaluates this as "if (true || uninitialised)". Whilst this error path does not incorrectly utilise the uninitialised data, as the ret evaluates to true already, it does leave a statement which includes an uninitialised variable. Help the static anlaysers by initialising the data variable when it is defined. Signed-off-by: Kieran Bingham --- src/libcamera/ipa_module.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp index 003611625214..2ddb02c1562e 100644 --- a/src/libcamera/ipa_module.cpp +++ b/src/libcamera/ipa_module.cpp @@ -291,7 +291,7 @@ int IPAModule::loadIPAModuleInfo() return ret; } - void *data; + void *data = NULL; size_t dataSize; void *map; size_t soSize;