{"id":11816,"url":"https://patchwork.libcamera.org/api/1.1/patches/11816/?format=json","web_url":"https://patchwork.libcamera.org/patch/11816/","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":"<20210401153123.1217170-1-hiroh@chromium.org>","date":"2021-04-01T15:31:22","name":"[libcamera-devel,1/2] android: cameraDevice: Factorize the code of validating camera3_capture_request","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"b7d095370869539d709f433911d57db7d97a2691","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/1.1/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11816/mbox/","series":[{"id":1880,"url":"https://patchwork.libcamera.org/api/1.1/series/1880/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1880","date":"2021-04-01T15:31:22","name":"[libcamera-devel,1/2] android: cameraDevice: Factorize the code of validating camera3_capture_request","version":1,"mbox":"https://patchwork.libcamera.org/series/1880/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11816/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11816/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 0DB2BC0DA4\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  1 Apr 2021 15:31:32 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id BB9A268784;\n\tThu,  1 Apr 2021 17:31:31 +0200 (CEST)","from mail-pl1-x632.google.com (mail-pl1-x632.google.com\n\t[IPv6:2607:f8b0:4864:20::632])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 24F146877D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  1 Apr 2021 17:31:30 +0200 (CEST)","by mail-pl1-x632.google.com with SMTP id ay2so1205693plb.3\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 01 Apr 2021 08:31:30 -0700 (PDT)","from hiroh2.tok.corp.google.com\n\t([2401:fa00:8f:2:908:1da:b07c:32bc])\n\tby smtp.gmail.com with ESMTPSA id\n\ty68sm6521573pgy.5.2021.04.01.08.31.26\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 01 Apr 2021 08:31:27 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=chromium.org header.i=@chromium.org\n\theader.b=\"leWC0ZKz\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org;\n\ts=google; h=from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Y/PNzeU1fZsVFI4njw6I9n7gzV5T0/98dB/4QVM+76E=;\n\tb=leWC0ZKzV0OdYB/EsGoXOmrrXbanz50tjM667Gohty6EqGNdl+zdMlli9QkgA5S4nH\n\tXxoANZaDbB0WxsqGpjZxxNZF+oSydPoZ5sjruEPChQiU8aHa7FqhiDv14CZbT5HEFonQ\n\txHVVVITOjSoa/tQJTWRc3HKxFeI8dSvoU2UbU=","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version\n\t:content-transfer-encoding;\n\tbh=Y/PNzeU1fZsVFI4njw6I9n7gzV5T0/98dB/4QVM+76E=;\n\tb=M6xWiH3U9tAlmFfH6r2TALKud34pU3URkAIGpnR/rDui3TsfCY4LzcbiNV3zW3At9D\n\tIHLMRlcg4Lntukw1GZcDFEOYHytgRZHev0k09odp/+eSW0Jd3/CE7aHwo+Ltu32Puj+q\n\tzE0n0fa20MTjUy2oFpH7eNE+sK7W9QyYyIHRJXHGPPmo3D2fInTXW3z6BrMljeS+WnYo\n\teereZe+0ERjGT4FpOqNrqR6pYDjlQvL0raYHwgC1uaCvZFD96EIq5ZnaensagJ+wwOFU\n\twFGB6eSqGLIxlgZyz6xzQ9q0bw07eOMvNUcl2GjQ9KzTkjUtaAjJGaQUYGE4SsTDbwRs\n\t2VzQ==","X-Gm-Message-State":"AOAM533nNK9dGVW0gFoBFE3mJhwI83uTD32+NGh44tWz1kfyYvMDe/JX\n\td0byp1mTqskTT5wahmNGjH8Vfvtw0ywmag==","X-Google-Smtp-Source":"ABdhPJyMtsvcvAH17B/A2GmBPC5Kfa6enzBJqV0Jr/9rBg+q3hx6jrlnnjB1vEq9/8ptAdSWd4VaRg==","X-Received":"by 2002:a17:90b:fce:: with SMTP id\n\tgd14mr9159500pjb.64.1617291088458; \n\tThu, 01 Apr 2021 08:31:28 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  2 Apr 2021 00:31:22 +0900","Message-Id":"<20210401153123.1217170-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.291.g576ba9dcdaf-goog","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 1/2] android: cameraDevice: Factorize the\n\tcode of validating camera3_capture_request","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>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"CameraDevice::processCaptureRequest() checks the validness of a\nprovided camera3_capture_request. This factorizes the code in\norder to add more validation to the request later.\n\nSigned-off-by: Hirokazu Honda <hiroh@chromium.org>\n---\n src/android/camera_device.cpp | 24 ++++++++++++++++--------\n 1 file changed, 16 insertions(+), 8 deletions(-)","diff":"diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp\nindex eb327978..48eb471d 100644\n--- a/src/android/camera_device.cpp\n+++ b/src/android/camera_device.cpp\n@@ -256,6 +256,21 @@ void sortCamera3StreamConfigs(std::vector<Camera3StreamConfig> &unsortedConfigs,\n \tunsortedConfigs = sortedConfigs;\n }\n \n+bool isValidRequest(camera3_capture_request_t *camera3Request)\n+{\n+\tif (!camera3Request) {\n+\t\tLOG(HAL, Error) << \"No capture request provided\";\n+\t\treturn false;\n+\t}\n+\n+\tif (!camera3Request->num_output_buffers) {\n+\t\tLOG(HAL, Error) << \"No output buffers provided\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn true;\n+}\n+\n } /* namespace */\n \n /*\n@@ -1785,15 +1800,8 @@ int CameraDevice::processControls(Camera3RequestDescriptor *descriptor)\n \n int CameraDevice::processCaptureRequest(camera3_capture_request_t *camera3Request)\n {\n-\tif (!camera3Request) {\n-\t\tLOG(HAL, Error) << \"No capture request provided\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\tif (!camera3Request->num_output_buffers) {\n-\t\tLOG(HAL, Error) << \"No output buffers provided\";\n+\tif (isValidRequest(camera3Request))\n \t\treturn -EINVAL;\n-\t}\n \n \t/* Start the camera if that's the first request we handle. */\n \tif (!running_) {\n","prefixes":["libcamera-devel","1/2"]}