From patchwork Tue Apr 14 07:06:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3457 Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0397462E31 for ; Tue, 14 Apr 2020 09:06:58 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="iSxTdUz1"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=S+v4RAoVKLe0XvAFmWW4et8axI5VN1wdFf8ju951NJY=; b=iSxTdUz1TgP+ysEVXruFPMB7XJU7t2b770QIn7XISR6ckyCCYw+Xx1O7dZekGLrS9po9 4dynmsh6TWU8bxV3Y3BrX7j+x2bDNUm2d69bvxq/+0YtB7vMUammyM0vBtzhru7WIZFdXB EDHAdbuVEWL/RMJ7wTYQbM7Z/HQm1fBJU= Received: by filterdrecv-p3iad2-8ddf98858-sn8p2 with SMTP id filterdrecv-p3iad2-8ddf98858-sn8p2-20-5E956111-26 2020-04-14 07:06:57.432960553 +0000 UTC m=+1586563.220500062 Received: from mail.uajain.com (unknown) by ismtpd0007p1hnd1.sendgrid.net (SG) with ESMTP id Xhih_PAwSjGBhw8mX9etdw Tue, 14 Apr 2020 07:06:57.100 +0000 (UTC) From: Umang Jain Date: Tue, 14 Apr 2020 07:06:57 +0000 (UTC) Message-Id: <20200414070642.22366-2-email@uajain.com> In-Reply-To: <20200414070642.22366-1-email@uajain.com> References: <20200414070642.22366-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPclKwCK9CCZVFbQyNjpl2ex98oO3ds1tcaHYAc4KXlWkV6EnsjS/a9ug/U04JAxz/w6m84h2HfbnBI0v0uPgxxqMhsyvu1gH8g12/Ozjx0nFCqkAxwNQPxgIqXwqV71yIRMHbwsdpAfwJqg8mmKWGSd8BDHpxqf7UFDRIvhVnn/oh7hdPGYjHNZPVBljhL26wGmSCgy3Y2W+RMli+aqNHYCg== To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH 1/3] test: list-camera: Handle error on starting the CameraManager 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: Tue, 14 Apr 2020 07:06:59 -0000 Pointed out by Coverity DefectId=297074 Signed-off-by: Umang Jain Reviewed-by: Laurent Pinchart --- test/list-cameras.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/list-cameras.cpp b/test/list-cameras.cpp index 55551d7..e6a407a 100644 --- a/test/list-cameras.cpp +++ b/test/list-cameras.cpp @@ -21,7 +21,10 @@ protected: int init() { cm_ = new CameraManager(); - cm_->start(); + if (cm_->start()) { + std::cout << "Failed to start camera" << std::endl; + return TestFail; + } return 0; } From patchwork Tue Apr 14 07:06:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3458 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3263B62E31 for ; Tue, 14 Apr 2020 09:07:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="kvWdn3qF"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=fNnGy3RvRFDdZhehFp4tLjtkmJxZA9e4wg6lLnfB9do=; b=kvWdn3qFcvEv8CnZ6cKExWEwaxg6bbcWnxhYkZDociL+MDtFLoTlgQrrCxo6PnzooZUr 7+gthZKrJchIXMUBxMZO84tXEimbu0MS+HhhjeVfGM7t/L2/RHjEF5TC74VFHhFo9fMPUn r33GjIS5+9Vqr5WhyGBAI7xSHxioqbZMQ= Received: by filter0084p3las1.sendgrid.net with SMTP id filter0084p3las1-28345-5E956112-A5 2020-04-14 07:06:58.689315235 +0000 UTC m=+1071357.482902598 Received: from mail.uajain.com (unknown) by ismtpd0005p1hnd1.sendgrid.net (SG) with ESMTP id 8C40N9AZQTGMs5WmDfmuYA Tue, 14 Apr 2020 07:06:58.233 +0000 (UTC) From: Umang Jain Date: Tue, 14 Apr 2020 07:06:58 +0000 (UTC) Message-Id: <20200414070642.22366-3-email@uajain.com> In-Reply-To: <20200414070642.22366-1-email@uajain.com> References: <20200414070642.22366-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcZj5z9XHfwy1Ge6f/0y1LY2f51WPNaWJRgsmMiF70i3Un7/X3xGc5O03jiwnriUbhzR+WCKswraEyFVRl6lf7CN1wH8e1dnyLvdWcnwQlSRCk4dh0aVSmmqPu1dsb3gwxzmoHRSsxOmwxTMJJQhts9Z2iAND3ru/F+vAOih75TF4Mhxvefe3t79JuDG0xKYfk To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH 2/3] libcamera: camera: Exclude streams whose configuration cannot be updated 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: Tue, 14 Apr 2020 07:07:00 -0000 This prevents a null-deference below in the loop. Pointed out by Coverity DefectId=279069 Signed-off-by: Umang Jain --- src/libcamera/camera.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp index 8c3bb2c..926e414 100644 --- a/src/libcamera/camera.cpp +++ b/src/libcamera/camera.cpp @@ -777,9 +777,11 @@ int Camera::configure(CameraConfiguration *config) p_->activeStreams_.clear(); for (const StreamConfiguration &cfg : *config) { Stream *stream = cfg.stream(); - if (!stream) + if (!stream) { LOG(Camera, Fatal) << "Pipeline handler failed to update stream configuration"; + continue; + } stream->configuration_ = cfg; p_->activeStreams_.insert(stream); From patchwork Tue Apr 14 07:06:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Umang Jain X-Patchwork-Id: 3459 X-Patchwork-Delegate: umang.jain@ideasonboard.com Return-Path: Received: from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A7E8362E41 for ; Tue, 14 Apr 2020 09:07:00 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=uajain.com header.i=@uajain.com header.b="XN2YPgeS"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com; h=from:subject:in-reply-to:references:mime-version:to:cc: content-transfer-encoding:content-type; s=s1; bh=ciyi7nLIPvT9ePashq6eXudVkrTZwv2SOMfzMQAOSgs=; b=XN2YPgeSV88mDGOPTHoOnBW22wZ/w2IPDdD4VH+fylFG8d9NWVaDjeJL6klvWc2HLUeB JtsJ7RNsXFpAPXMKzbTnRBfYTr22gJiBzM8C5uR8N/EGmIWPeWuy2WmdG7hJL3mZstnYnE ID6wpY9J9bbv4wVq53TizoZZZvB+Tl+1o= Received: by filter0081p3las1.sendgrid.net with SMTP id filter0081p3las1-23682-5E956112-11D 2020-04-14 07:06:59.17861901 +0000 UTC m=+1071360.368382965 Received: from mail.uajain.com (unknown) by ismtpd0005p1maa1.sendgrid.net (SG) with ESMTP id ILp-WIe8Q3W3Y1zovR9l5w Tue, 14 Apr 2020 07:06:58.670 +0000 (UTC) From: Umang Jain Date: Tue, 14 Apr 2020 07:06:59 +0000 (UTC) Message-Id: <20200414070642.22366-4-email@uajain.com> In-Reply-To: <20200414070642.22366-1-email@uajain.com> References: <20200414070642.22366-1-email@uajain.com> Mime-Version: 1.0 X-SG-EID: 1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPc8Y1sFjEEckHl5AFRmKDueuFuam3Ti9xR18CbViEtKZIG6JOaQQXh4HDflpOF0cviKfs19XJXwE5xmjAb0wuStb5hkUBFmPGJ8v2ACSrJ2ms1kDdGNHoQ0MXQn7npCNNJ4VTOLpRUl5FoaeCv0T2XX12+BiyJX8BH/EAgE6hKH0WeCnnQmHAKctlQSyqDr6/J To: libcamera-devel@lists.libcamera.org Subject: [libcamera-devel] [PATCH 3/3] test: v4l2_videodevice: buffer_cache: Fail the test if no buffer from cache is obtained 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: Tue, 14 Apr 2020 07:07:01 -0000 Failing the test guards against negative index (-ENOENT in this case) being passed to V4L2BufferCache::put(). Pointed out by Coverity DefectId=279090 Signed-off-by: Umang Jain --- test/v4l2_videodevice/buffer_cache.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp index d730e75..1870249 100644 --- a/test/v4l2_videodevice/buffer_cache.cpp +++ b/test/v4l2_videodevice/buffer_cache.cpp @@ -90,6 +90,11 @@ public: /* Pick a hot buffer at random and store its index. */ int hotBuffer = dist(generator_); int hotIndex = cache->get(*buffers[hotBuffer].get()); + if (hotIndex < 0) { + std::cout << "Failed lookup from cache" << std::endl; + return TestFail; + } + cache->put(hotIndex); /*