From patchwork Fri Nov 22 14:03:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 2344 Return-Path: Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 01DC36136E for ; Fri, 22 Nov 2019 15:01:55 +0100 (CET) X-Originating-IP: 93.34.114.233 Received: from uno.lan (93-34-114-233.ip49.fastwebnet.it [93.34.114.233]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 797252000B; Fri, 22 Nov 2019 14:01:55 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 22 Nov 2019 15:03:46 +0100 Message-Id: <20191122140346.11040-1-jacopo@jmondi.org> X-Mailer: git-send-email 2.23.0 MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] test: controls: control_list: Add status check 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: , X-List-Received-Date: Fri, 22 Nov 2019 14:01:56 -0000 Since commit: fac471e812a9 ("test: Extract CameraTest class out of camera tests to libtest") the control_list is a subclass of CameraTest, and the status returned by the base class init() operation should be inspected to avoid accessing uninitialized fields during the run() operation execution. If the VIMC test module is not loaded, executing the test results in a segfault. Fix this by adding the init() operation where to status_ flag is checked for errors. Fixes: fac471e812a9 ("test: Extract CameraTest class out of camera tests to libtest") Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- test/controls/control_list.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/controls/control_list.cpp b/test/controls/control_list.cpp index 4d212abd09e6..5374c6f99f80 100644 --- a/test/controls/control_list.cpp +++ b/test/controls/control_list.cpp @@ -29,7 +29,12 @@ public: } protected: - int run() + int init() override + { + return status_; + } + + int run() override { CameraControlValidator validator(camera_.get()); ControlList list(controls::controls, &validator);