Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3536184pxf; Mon, 15 Mar 2021 11:45:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJysxq+Ml5Eq8j78gB7TwL9orWDMUquHdNvuDvqRo8hvS8rFaVHbn4kpNGHGjazLlf7bGgZj X-Received: by 2002:a05:6402:1855:: with SMTP id v21mr31639919edy.310.1615833936652; Mon, 15 Mar 2021 11:45:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615833936; cv=none; d=google.com; s=arc-20160816; b=kA2+GANBpbiQOSrXwtntKyY9BAkHMxIbPR+fH1zy2Vy/AsR+SSxKIgxPGV7/0p3HS1 wRLZE3sXaVn6n5hlIQsCgYLpYXiMXGKQJneeKD3Mx4qzqDvpz0wPncPHRBC7wASx75cC LA6/RytY7f9gxPjeJctxevKSVVFKmqAlUeyHZBJxmbX6423EY32qAjnSrJiDLHAguvN7 54pmEUbbOnl6s1ucQa37ndCKVg9ScVK9afQPBCYofXyiXGUqUtDL7CBw7Kh5+c/dXmHB /NQADZmIjdCOknX562xIyabzzV5w0KeUphhCYJZKVfOUPC0mWirHOvhCDgrbG+aGA1uH tt6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=5GhB9wAVAmGCMsv6tNmoEvGVMgcHMI+Nh//R6KNIA+Y=; b=Yn7F3dsHkNYNi9xHNNEgnGFBguxSVS/DIFXzxnD/OkAjrXzjYWszhdLRN3h8gU45uU e+ATirvuisZ5xFpnGrByvbs61HYP4W3r/sHfJ/8I/IFOU1U8TBNfw/FdMsnCWmTApR70 BmEiadrDJrxVYe2/ggg+OxJ2sNVFXvDO17hOq1B8jd7wkDZJ0S9SBl/LNbMpGA5cgsON UawTtoMZYq5ni7rbPTOdIPvCgtP44oGqetBt1YMWl2ayo2Wv6DuHwe8aXqvMWwaLQ4wc 6ujiOIEEZ/RDPJGmTv0hpuZO+DcMS3SJH1Z3jB3X9gQhbVtNpEZv/1jzsWdpJKelkKvH +ESA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Tq6QL1HT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m26si12653189edv.514.2021.03.15.11.45.13; Mon, 15 Mar 2021 11:45:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Tq6QL1HT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236402AbhCORgn (ORCPT + 99 others); Mon, 15 Mar 2021 13:36:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234675AbhCORgP (ORCPT ); Mon, 15 Mar 2021 13:36:15 -0400 Received: from mail-ed1-x52c.google.com (mail-ed1-x52c.google.com [IPv6:2a00:1450:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 36A1FC06174A for ; Mon, 15 Mar 2021 10:36:15 -0700 (PDT) Received: by mail-ed1-x52c.google.com with SMTP id e7so18313799edu.10 for ; Mon, 15 Mar 2021 10:36:15 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=5GhB9wAVAmGCMsv6tNmoEvGVMgcHMI+Nh//R6KNIA+Y=; b=Tq6QL1HTQl9oJWcOckVNIZuaezqCTDxvYarbY7vOXTZ5nE5fD/M7SFb1z2ckT4OCPN LYYQfR3+VlJMYZY36Xgc1WdmdDQ040L3ujLsz9te3Wria+nMoAjvwWAq13sed14vRiGl IzG/L94Hq3upktn5m5zL2Gq5LP9MEOJhNfgD8= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=5GhB9wAVAmGCMsv6tNmoEvGVMgcHMI+Nh//R6KNIA+Y=; b=HyVfBNpMVxPtRl8aJco66bx0chciR1XdZ6U/j0DLEOCUxoATqZOnQnI/cDzHNvVDs3 b1zMn5roVz606WTLhJSM4pbluzimbRdooYvgEYhS5w+7f4qVSXijeFcEYtNc6QcUuJjm r+qdSlg3+6qS0ia5Z6O+tLmR5ll2mdk7REOyfHh6VoaB78hvinPTdEROyywCy2t29MC0 dzJ4pUXTFZSU7bj5sDkbo4OdnmdtKAb2RwSbjrO52UYrsAk62LUXN5/d1DuS9IArgG96 j3rZ4aO02osBU6RyWd0FY/H/M4jweBeIgCwJ70bbPoATIu6EQaG7WsTie0m2sxP6sRT2 6OZQ== X-Gm-Message-State: AOAM530yHFJfZi4R4yxKA02gz+6yPeFFjSVF3FJvWix21JxCB6R5KBGS TRmFON/oaMxO+JUxCD8WyoXz1g== X-Received: by 2002:aa7:d954:: with SMTP id l20mr31319101eds.1.1615829773954; Mon, 15 Mar 2021 10:36:13 -0700 (PDT) Received: from alco.lan ([80.71.134.83]) by smtp.gmail.com with ESMTPSA id a3sm8109239ejv.40.2021.03.15.10.36.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Mar 2021 10:36:13 -0700 (PDT) From: Ricardo Ribalda To: Laurent Pinchart , Mauro Carvalho Chehab , Hans Verkuil , Sergey Senozhatsky , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ricardo Ribalda Subject: [PATCH v4 04/11] media: uvcvideo: set error_idx to count on EACCESS Date: Mon, 15 Mar 2021 18:36:02 +0100 Message-Id: <20210315173609.1547857-5-ribalda@chromium.org> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog In-Reply-To: <20210315173609.1547857-1-ribalda@chromium.org> References: <20210315173609.1547857-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If an error is found when validating the list of controls passed with VIDIOC_G_EXT_CTRLS, then error_idx shall be set to ctrls->count to indicate to userspace that no actual hardware was touched. It would have been much nicer of course if error_idx could point to the control index that failed the validation, but sadly that's not how the API was designed. Fixes v4l2-compliance: Control ioctls (Input 0): fail: v4l2-test-controls.cpp(645): invalid error index write only control test VIDIOC_G/S/TRY_EXT_CTRLS: FAIL Signed-off-by: Ricardo Ribalda Reviewed-by: Hans Verkuil --- drivers/media/usb/uvc/uvc_v4l2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 157310c0ca87..36eb48622d48 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -1073,7 +1073,8 @@ static int uvc_ioctl_g_ext_ctrls(struct file *file, void *fh, ret = uvc_ctrl_get(chain, ctrl); if (ret < 0) { uvc_ctrl_rollback(handle); - ctrls->error_idx = i; + ctrls->error_idx = (ret == -EACCES) ? + ctrls->count : i; return ret; } } -- 2.31.0.rc2.261.g7f71774620-goog