[{"id":2310,"web_url":"https://patchwork.libcamera.org/comment/2310/","msgid":"<20190801143254.GE5024@pendragon.ideasonboard.com>","date":"2019-08-01T14:32:54","subject":"Re: [libcamera-devel] [PATCH v2] libcamera: ipa_module: prevent\n\tuninitialised access","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"Hi Kieran,\n\nThank you for the patch.\n\nOn Thu, Aug 01, 2019 at 12:38:50PM +0100, Kieran Bingham wrote:\n> The IPAModule::loadIPAModuleInfo() function includes a *data pointer\n> which is used as a null-pointer comparison in the error path with a\n> conditional statement of \"if (ret || !data)\".\n> \n> The data variable is not initialised, and a single error path evaluates\n> this as \"if (true || uninitialised)\".\n> \n> Whilst this error path does not incorrectly utilise the uninitialised\n> data, as the ret evaluates to true already, it does leave a statement\n> which includes an uninitialised variable.\n> \n> Help the static analysers by initialising the data variable when it is\n> defined.\n> \n> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> ---\n> v2:\n>  - s/NULL/nullptr/\n>  - Fix spelling in commit-message\n> \n>  src/libcamera/ipa_module.cpp | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/src/libcamera/ipa_module.cpp b/src/libcamera/ipa_module.cpp\n> index 003611625214..99d308efd47b 100644\n> --- a/src/libcamera/ipa_module.cpp\n> +++ b/src/libcamera/ipa_module.cpp\n> @@ -291,7 +291,7 @@ int IPAModule::loadIPAModuleInfo()\n>  \t\treturn ret;\n>  \t}\n>  \n> -\tvoid *data;\n> +\tvoid *data = nullptr;\n>  \tsize_t dataSize;\n>  \tvoid *map;\n>  \tsize_t soSize;","headers":{"Return-Path":"<laurent.pinchart@ideasonboard.com>","Received":["from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 06C5B60E38\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Aug 2019 16:32:57 +0200 (CEST)","from pendragon.ideasonboard.com\n\t(dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi\n\t[IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 816F1CC;\n\tThu,  1 Aug 2019 16:32:56 +0200 (CEST)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1564669976;\n\tbh=KyYIpqZ8w+vJmHDg4SHuZuYYrX0xIi4OSr//2xnyEZI=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=pHsXd0t4bW7/ZtjDl8VSysF3JfHX1KsrM0+0ceJK3wnAwmFSuDlQSu5FYsb17pGoq\n\tDqyqy9ccTv+VxUartRbkzQoe9oN3YsQbcIGKwbuCKvJWlafjiKJ6Wz4rvYZc/aEboY\n\tddBj3z7gf+hL2sfwzITWogOwqJJfMwxW67dvtMjQ=","Date":"Thu, 1 Aug 2019 17:32:54 +0300","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"LibCamera Devel <libcamera-devel@lists.libcamera.org>","Message-ID":"<20190801143254.GE5024@pendragon.ideasonboard.com>","References":"<20190801113850.4920-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20190801113850.4920-1-kieran.bingham@ideasonboard.com>","User-Agent":"Mutt/1.10.1 (2018-07-13)","Subject":"Re: [libcamera-devel] [PATCH v2] libcamera: ipa_module: prevent\n\tuninitialised access","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.23","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","X-List-Received-Date":"Thu, 01 Aug 2019 14:32:57 -0000"}}]