{"id":3465,"url":"https://patchwork.libcamera.org/api/patches/3465/?format=json","web_url":"https://patchwork.libcamera.org/patch/3465/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20200415054503.13108-2-email@uajain.com>","date":"2020-04-15T05:45:20","name":"[libcamera-devel,v2,1/2] libcamera: camera: Return -EINVAL if any stream is null while configure()","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"116d863440bceac076231e8f0e87ab67f3974e3d","submitter":{"id":1,"url":"https://patchwork.libcamera.org/api/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3465/mbox/","series":[{"id":810,"url":"https://patchwork.libcamera.org/api/series/810/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=810","date":"2020-04-15T05:45:14","name":"More coverity scan fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/810/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3465/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3465/checks/","tags":{},"headers":{"Return-Path":"<bounces+15657259-5c31-libcamera-devel=lists.libcamera.org@em7280.uajain.com>","Received":["from o1.f.az.sendgrid.net (o1.f.az.sendgrid.net [208.117.55.132])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 747B260401\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Apr 2020 07:45:21 +0200 (CEST)","by filterdrecv-p3iad2-8ddf98858-rpdh9 with SMTP id\n\tfilterdrecv-p3iad2-8ddf98858-rpdh9-19-5E969F6F-7B\n\t2020-04-15 05:45:19.993893761 +0000 UTC m=+1744665.744333156","from mail.uajain.com (unknown)\n\tby ismtpd0003p1hnd1.sendgrid.net (SG) with ESMTP\n\tid A3swGOmzQziNlN_GX-F5eA Wed, 15 Apr 2020 05:45:19.659 +0000 (UTC)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=uajain.com\n\theader.i=@uajain.com header.b=\"Mj/sIodP\"; \n\tdkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=uajain.com;\n\th=from:subject:in-reply-to:references:mime-version:to:cc:\n\tcontent-transfer-encoding:content-type;\n\ts=s1; bh=lrbXJDnJcq4VZgT3K6ez6zxjNNaIGEwmsRuz1QvxbIA=;\n\tb=Mj/sIodPu443dqkhVsTPg82eG5deXLSMb+cMoBkfsLpjeGdwi2JptxRk8QnO3LgFEwC2\n\t3rglKkXBlN2ovqbmyIgxxNDpFy1biIqsVb0Jy98A3kRbvPornaDFz/lKFxLcvrpBUMEYEY\n\tX8wq09j4ZtQhwbLhPVf15v3AKFkfTXZrs=","From":"Umang Jain <email@uajain.com>","Date":"Wed, 15 Apr 2020 05:45:20 +0000 (UTC)","Message-Id":"<20200415054503.13108-2-email@uajain.com>","In-Reply-To":"<20200415054503.13108-1-email@uajain.com>","References":"<20200415054503.13108-1-email@uajain.com>","Mime-Version":"1.0","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcREc2X1LpIgLW8oEasGbegwNe7IMCDmAC73/5ndg0KnN8FeRmppZxrI4nW6/opvAP7npBHmfip7NzsBQ9kBknVuSlOji4fyN3tF9F4ujBj/4a63dtsieeSGvAB68WDRoZK5JzCNCSpGSBjj7DPi/doS7udR93H6C5c3LRrPPc9XhaWooOGDijoPvOPYXwceeZCi+6vffp26KxMzf7PtSMfg==","To":"libcamera-devel@lists.libcamera.org","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=us-ascii","Subject":"[libcamera-devel] [PATCH v2 1/2] libcamera: camera: Return -EINVAL\n\tif any stream is null while configure()","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","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":"Wed, 15 Apr 2020 05:45:21 -0000"},"content":"Fail and return the Camera::configure() operation if any\nof the stream turns out to be a nullptr even after the\nPipelineHandler handler seems to have configured the config\nsuccessfully. This prevents a null-dereference below in the\nloop.\n\nPointed out by Coverity DefectId=279069\n\nSigned-off-by: Umang Jain <email@uajain.com>\n---\n src/libcamera/camera.cpp | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)","diff":"diff --git a/src/libcamera/camera.cpp b/src/libcamera/camera.cpp\nindex 8c3bb2c..9d2607b 100644\n--- a/src/libcamera/camera.cpp\n+++ b/src/libcamera/camera.cpp\n@@ -777,9 +777,12 @@ int Camera::configure(CameraConfiguration *config)\n \tp_->activeStreams_.clear();\n \tfor (const StreamConfiguration &cfg : *config) {\n \t\tStream *stream = cfg.stream();\n-\t\tif (!stream)\n+\t\tif (!stream) {\n \t\t\tLOG(Camera, Fatal)\n \t\t\t\t<< \"Pipeline handler failed to update stream configuration\";\n+\t\t\tp_->activeStreams_.clear();\n+\t\t\treturn -EINVAL;\n+\t\t}\n \n \t\tstream->configuration_ = cfg;\n \t\tp_->activeStreams_.insert(stream);\n","prefixes":["libcamera-devel","v2","1/2"]}