{"id":3799,"url":"https://patchwork.libcamera.org/api/1.1/patches/3799/?format=json","web_url":"https://patchwork.libcamera.org/patch/3799/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20200515124245.18040-5-email@uajain.com>","date":"2020-05-15T12:42:54","name":"[libcamera-devel,v2,4/4] 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/1.1/people/1/?format=json","name":"Umang Jain","email":"email@uajain.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/3799/mbox/","series":[{"id":905,"url":"https://patchwork.libcamera.org/api/1.1/series/905/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=905","date":"2020-05-15T12:42:52","name":"Coverity scan fixes","version":2,"mbox":"https://patchwork.libcamera.org/series/905/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/3799/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/3799/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 4C8E560E13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 May 2020 14:42:56 +0200 (CEST)","by filter0073p3las1.sendgrid.net with SMTP id\n\tfilter0073p3las1-3640-5EBE8E4E-78\n\t2020-05-15 12:42:54.653166209 +0000 UTC m=+2558432.897400713","from mail.uajain.com (unknown)\n\tby ismtpd0004p1maa1.sendgrid.net (SG) with ESMTP id\n\toFd7B2YPR3uLTzPSq6__pw for <libcamera-devel@lists.libcamera.org>;\n\tFri, 15 May 2020 12:42:54.314 +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=\"kRhlQZhY\"; \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=ypx0l5S1eElZCfSsU6JNux9dqR9MqHq//0HJwRPZiXQ=;\n\tb=kRhlQZhYSMduwhgznKTjuIUNOOjSXmksmAbzA0U4rWxCTeYlijM7Fp1w14lsmSl/e/EE\n\tqkjVWnWQ7YX2RhVgqJvgMbKZ7+6JPZUSRZSJtiqK69jOzLf4cOMh7L4xmTFbCnFmFDlpDV\n\tGDc1CXccT2aZyzH+rEk4dAjqEh/u+Se2A=","From":"Umang Jain <email@uajain.com>","Date":"Fri, 15 May 2020 12:42:54 +0000 (UTC)","Message-Id":"<20200515124245.18040-5-email@uajain.com>","In-Reply-To":"<20200515124245.18040-1-email@uajain.com>","References":"<20200515124245.18040-1-email@uajain.com>","Mime-Version":"1.0","X-SG-EID":"1Q40EQ7YGir8a9gjSIAdTjhngY657NMk9ckeo4dbHZDiOpywc/L3L9rFqlwE4KPcHcG1g99dnq0SJ9KzJgHEPjOpQm5nI00z0W5yXxIY20eIcETDJ2Ss6SYI8o0hWQQY0W/VcDAzx52NVFzR2xL95/5ThFhdtAZmVqw1oZmMRBaCp5qCiFYCcFYR7J7oKqlAkDomGRBcm4EvbvC9G8Drm9e2636Ve23+nxTExsPgeL4xCUETGEIwyrlDMg4iHAUJ","To":"libcamera-devel <libcamera-devel@lists.libcamera.org>","Content-Transfer-Encoding":"7bit","Content-Type":"text/plain; charset=us-ascii","Subject":"[libcamera-devel] [PATCH v2 4/4] 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":"Fri, 15 May 2020 12:42:58 -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","4/4"]}