{"id":11818,"url":"https://patchwork.libcamera.org/api/patches/11818/?format=json","web_url":"https://patchwork.libcamera.org/patch/11818/","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":"<20210402015529.1284943-1-hiroh@chromium.org>","date":"2021-04-02T01:55:28","name":"[libcamera-devel,v2,1/2] android: cameraDevice: Factorize the code of validating camera3_capture_request","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"f08199ac897658c347ac3b83deb374bf1df6cd9c","submitter":{"id":63,"url":"https://patchwork.libcamera.org/api/people/63/?format=json","name":"Hirokazu Honda","email":"hiroh@chromium.org"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/11818/mbox/","series":[{"id":1881,"url":"https://patchwork.libcamera.org/api/series/1881/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1881","date":"2021-04-02T01:55:28","name":"[libcamera-devel,v2,1/2] android: cameraDevice: Factorize the code of validating camera3_capture_request","version":2,"mbox":"https://patchwork.libcamera.org/series/1881/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/11818/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/11818/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 EBCD6C0DA3\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri,  2 Apr 2021 01:55:40 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4FF3E68783;\n\tFri,  2 Apr 2021 03:55:40 +0200 (CEST)","from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com\n\t[IPv6:2607:f8b0:4864:20::1034])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 01D9A68780\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri,  2 Apr 2021 03:55:38 +0200 (CEST)","by mail-pj1-x1034.google.com with SMTP id w8so2045290pjf.4\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 01 Apr 2021 18:55:38 -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\ta65sm6540329pfb.116.2021.04.01.18.55.35\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 01 Apr 2021 18:55:36 -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=\"C7CDCqqn\"; 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=CWvnM27sMJybluUYtLViRKdO83r8N0cZtWfmPfv2wjQ=;\n\tb=C7CDCqqnMzoVdTbGk3TSA9IWP+VR0X2wpV7KcOK/w/2hqPbybLqRZQWgXMtm5yDKDx\n\tN0mViyb9OSnYhiPXQMwAMQtL991sInbBgf4NSG/AhgMntkLQEaDvZI7JxwsiN5sc66wj\n\txp5WNX/zOUkiBZEUFhSTue+5MDn7uM3nXzmAQ=","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=CWvnM27sMJybluUYtLViRKdO83r8N0cZtWfmPfv2wjQ=;\n\tb=cIBXk3NDe5ptwUU1VH+gIqUHA7h0MFmbRDLgvTTilzD1JcZGl+tEVvzWCLp8MLE+sf\n\tdBAD8VATKNAjbt3b7eTtbxHEbZALhp3tbezybnVMHWbF9z06lccAL6fDDe+vJ18QeWrR\n\tCN3qSg0fdnY2uN33OVA0kYAcJl541wiHL//VcrJGhjA22+JBOaxCGpWCaFm8rE5qJZ/M\n\tGLvcFzXe9aBA5P7HQ3MQy/ohwAo+fnA+hHI0yek4vEU4kVCJaGBLssKMQ7s8a6dO83IZ\n\t2fqYgUK7bXEJ7TVXmexI1k8EgTnsuE7iYSEEcDjXUIVw2mnMPHfYloGNzWGwWym+Y8UG\n\tn71w==","X-Gm-Message-State":"AOAM530RC6t8FHUFB015tHH+SP1+m9tEtwEt1zl3dxK4FTPBrjT6E3YU\n\tv48fazXA5t/zMT0ReM6u5x2YAQYXMmJ59w==","X-Google-Smtp-Source":"ABdhPJzcEh9FsCjoRvLr1E47rS6ElXS3lbpb/P5eAx94LOJ52pGu2UcYNLq68EoejGvG/IKURBbHwg==","X-Received":"by 2002:a17:90a:7a8b:: with SMTP id\n\tq11mr11752151pjf.215.1617328537127; \n\tThu, 01 Apr 2021 18:55:37 -0700 (PDT)","From":"Hirokazu Honda <hiroh@chromium.org>","To":"libcamera-devel@lists.libcamera.org","Date":"Fri,  2 Apr 2021 10:55:28 +0900","Message-Id":"<20210402015529.1284943-1-hiroh@chromium.org>","X-Mailer":"git-send-email 2.31.0.208.g409f899ff0-goog","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 1/2] android: cameraDevice: Factorize\n\tthe code 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>\nReviewed-by: Jacopo Mondi <jacopo@jmondi.org>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\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..988c1fd5 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 false;\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+\tif (isValidRequest(camera3Request))\n \t\treturn -EINVAL;\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 \t/* Start the camera if that's the first request we handle. */\n \tif (!running_) {\n","prefixes":["libcamera-devel","v2","1/2"]}