From patchwork Thu Aug 1 11:38:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 1720 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 98520615DF for ; Thu, 1 Aug 2019 13:38:55 +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 08079CC; Thu, 1 Aug 2019 13:38:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1564659535; bh=I/2O4IKzSCl8O6/SLLWnJJQkunL5UitqfnIeOhzHG18=; h=From:To:Cc:Subject:Date:From; b=iKsSikbXr/zc+p96gvGBHQ2BIpOJ1Hb61ixGo5RGNzFqel2c7JsPWeh1RpiwowAJA 1oMEqjBdK0bpRMZfoegMNFpLW6zXyjoZZ5ZEJJ6oELQ1d9YDJzmrnNtapSTmwJU5nV XXFiJJ1ymT+lsnkPc5gsokMIbbQ8CeCK2FxNOb/0= From: Kieran Bingham To: LibCamera Devel Date: Thu, 1 Aug 2019 12:38:50 +0100 Message-Id: <20190801113850.4920-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2] 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, 01 Aug 2019 11:38:55 -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 analysers by initialising the data variable when it is defined. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- v2: - s/NULL/nullptr/ - Fix spelling in commit-message 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..99d308efd47b 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 = nullptr; size_t dataSize; void *map; size_t soSize;