From patchwork Sat Apr 3 13:18:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hirokazu Honda X-Patchwork-Id: 11829 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 31B87BD695 for ; Sat, 3 Apr 2021 13:18:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9CCCC602E6; Sat, 3 Apr 2021 15:18:38 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="E/FGB+bM"; dkim-atps=neutral Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id A6922602CF for ; Sat, 3 Apr 2021 15:18:36 +0200 (CEST) Received: by mail-pg1-x532.google.com with SMTP id p12so1196140pgj.10 for ; Sat, 03 Apr 2021 06:18:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FRYwpVwp47U1QWe3DEdYTBnq/3J1MCNkAkBcVyEVTEU=; b=E/FGB+bMznCyo98UZpHZgUMyUTKNKv1qT/Dx/7Mhr+9QdOS5JDwUODh+1cOAmCGrQy 9McNdproX5Bx98fLhFTgvxwyL3JCZ865SbcbWWFfgVnCbdBEvZR6z1WRWhb+mEZ48hwM afQ6tBrAhhrPNDlfeRgNy6FsKGVdfLS1ap8t8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FRYwpVwp47U1QWe3DEdYTBnq/3J1MCNkAkBcVyEVTEU=; b=slbNeBor+lamruEk10ndSmwYo/RCSP1AoOBQEvFc98Jd4y06u/JYalP3/Jhcu8pD7Y 1h8dUUXWmRSiNxSIhPU40NA2hqlY+PseEWZWI+D9JHustIfZFVuUSrU8wvJT1MQfbkak dTUe2QW9qRAQJd22k1xsJjJkObSqKDTM2lBvBIVeTMqo/A84+Mt4wZBF+YsaWVfA/uTK zPftBT3TQW7NB6r94utJ1coU4EtyRXF8UcLnce4oZa1U3an806owLyeeQQb7qYQBv42p +0xf4CI3h7BcCEDBg+waz8lpteOzWHn9CDKmFxRZa0H5Ok088+GSihjwa6lTmMdsAJ1D fJUQ== X-Gm-Message-State: AOAM533YUIZXx3rxE2XiVbJIhGa62c0rdL1MmG+LQ9v9bkInYV7kcZKk 9fu8p0ls49QgocBlatesrrcagYFCpv7oBQ== X-Google-Smtp-Source: ABdhPJx3oKgd89OTs+rMU/xb5NHTAjuwfJ/qD4cwTMl9/z7cJ/poUBL4ySQ+3SgiZkCXvYdv2TezsQ== X-Received: by 2002:a63:925a:: with SMTP id s26mr15062689pgn.216.1617455914977; Sat, 03 Apr 2021 06:18:34 -0700 (PDT) Received: from hiroh2.tok.corp.google.com ([2401:fa00:8f:2:d1f5:1b96:f027:f646]) by smtp.gmail.com with ESMTPSA id m7sm11380819pfd.52.2021.04.03.06.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 03 Apr 2021 06:18:34 -0700 (PDT) From: Hirokazu Honda To: libcamera-devel@lists.libcamera.org Date: Sat, 3 Apr 2021 22:18:28 +0900 Message-Id: <20210403131828.1591652-1-hiroh@chromium.org> X-Mailer: git-send-email 2.31.0.208.g409f899ff0-goog MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH] android: CameraDevice: Deny if the streams is empty 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: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" This checks if the number of streams is zero on configuration and then returns -EINVAL. Signed-off-by: Hirokazu Honda Reviewed-by: Umang Jain Reviewed-by: Laurent Pinchart --- src/android/camera_device.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/android/camera_device.cpp b/src/android/camera_device.cpp index eb327978..f175ce53 100644 --- a/src/android/camera_device.cpp +++ b/src/android/camera_device.cpp @@ -1554,6 +1554,11 @@ int CameraDevice::configureStreams(camera3_stream_configuration_t *stream_list) running_ = false; } + if (stream_list->num_streams == 0) { + LOG(HAL, Error) << "Empty stream configuration"; + return -EINVAL; + } + /* * Generate an empty configuration, and construct a StreamConfiguration * for each camera3_stream to add to it.