Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2654979lqb; Tue, 28 May 2024 06:46:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvyZuejYL81XBlv/XrforIbK3pDzWg9MC1MEdaRCmXdmJMtbMWvbl7Um1wrkOCddq/dTyYoNvQxiDkzuuxeqI5NzmXKc6Mg21XAAURAw== X-Google-Smtp-Source: AGHT+IGh7exya0YIFviz6kUd324B9viv+wqOLLkUFaB8ta39XhClFD1FVUsD8sufCMdg7WPYZRrq X-Received: by 2002:a05:6358:3124:b0:186:1f52:540d with SMTP id e5c5f4694b2df-197e566dc96mr1251587255d.28.1716903981286; Tue, 28 May 2024 06:46:21 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716903981; cv=pass; d=google.com; s=arc-20160816; b=O7d2y9K2+As5CXhCNeYJ83bN2n5ijCnaUcSZtbAt+9jNZGkWq4UleT5tp9TfHzZLlH y08GPPLN2lf1rgMNFp2L9NPUf3Q7MoRWEmVVJUU7CX61eat9r0BqUto9HmVPa0XLv6y3 Q+QqB8+ybsXw1EEoX0CmjZdgx/L7YMKPbaqaavZ1pnPBkb6OWs2HB1teDvZqj6Ig+Qfp GN84RSdr80+cBtAxX9UENnFzlHFDL9DtEqS8X4KtIIHUy+tBJX/oGUhRcy67vplk4nVk 2wApyEW+f+9UWAZusc6qq8YLLCcwTTvpTCzubHPVdAkcaA9ELehdWGjw1GhofoL2/G3b Lvew== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:mail-followup-to :message-id:subject:cc:to:from:date; bh=aNadBB3b0lyzdJKxyhAJqo5QtWGcgWqdmws8DwyoWW0=; fh=bd5LmHc1dypUi1sO1Z7n/GGJjN94dBeUnT/CpruY6eY=; b=rxpaKWq6JyTklaw6YEtyVAYIJYfEx/AKyx/VD+KaHqGRs6VAsd7kRKE8gb+WOcEXet XvBEObooYU2AnM/zej2ozOdTGVlwNy573iz2Hs7wqgAmc7i8KC2MxUgyNIKaurK5BrxR 7N2XbE0ayXtooH8ccxH1CjnCr7YrT92TveQYVn9YIJxFzIr9jmiVGg4r4T0J3BgGSZBr BvvI/Gv0Fvz8FiUWdVsDJDSoANaSkZTfnygCffJyvIDlCRAXKMAgLCkSOwyJIIxEZ1+b v5TSkkApg6GBlC2arb7KMuLcnKDY9e8jMIAZmMhOIPN4dfEC+fW13L+j9Ipjd5rzEJGp YVLQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-192444-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192444-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abd4bc3asi989759785a.579.2024.05.28.06.46.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 06:46:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-192444-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=pengutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-192444-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-192444-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id E834B1C22732 for ; Tue, 28 May 2024 13:46:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A7CB16F287; Tue, 28 May 2024 13:46:13 +0000 (UTC) Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 947441DFEB for ; Tue, 28 May 2024 13:46:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716903973; cv=none; b=ZsVQ0J0nDzyi7l4U0tn8alJZCZUhoM/+mluUaQ4DKgIpyzZ2TyrXOe46WXPN5ugIftSDOgXIHbUaz0INto2FY4z3e9bnWXXNmva+gI7vSRLqWgW4rjC3RCsfV/tCXNH/s9zXV25mAYQsD+a7Acl5glkUgNpIR+O3X07D1lpa7Gc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716903973; c=relaxed/simple; bh=KcBKNOc/a0yWDzrzTnBHacI/v+q0k5/IM/NT7bw/qN4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=GcoYO2tH9ouAgmW6lWyykqUwAPAWYEmyLDBXlt17rY0orh4lOxJMm5CiJCC1W7F60RWA47A2IVWmgYn8bNW+ZEAXswZUT7V4oBgzrXbCg1K/J5+GTN3EM+tS0lIamMi+6yFrVwhId5bmIwjKMU2dZQuRcxItqMJIBdfsfSp9oDE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sBx9R-0002U4-Hb; Tue, 28 May 2024 15:46:05 +0200 Received: from [2a0a:edc0:2:b01:1d::c5] (helo=pty.whiteo.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sBx9Q-003Kpq-MF; Tue, 28 May 2024 15:46:04 +0200 Received: from mtr by pty.whiteo.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1sBx9Q-001NB5-1x; Tue, 28 May 2024 15:46:04 +0200 Date: Tue, 28 May 2024 15:46:04 +0200 From: Michael Tretter To: Nas Chung Cc: mchehab@kernel.org, linux-media@vger.kernel.org, sebastian.fricke@collabora.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Message-ID: Mail-Followup-To: Michael Tretter , Nas Chung , mchehab@kernel.org, linux-media@vger.kernel.org, sebastian.fricke@collabora.com, linux-kernel@vger.kernel.org References: <20240528020425.4994-1-nas.chung@chipsnmedia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240528020425.4994-1-nas.chung@chipsnmedia.com> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mtr@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org On Tue, 28 May 2024 11:04:25 +0900, Nas Chung wrote: > Explicitly compare a buffer type only with valid buffer types, > to avoid matching the buffer type outside of valid buffer > type set. > > Signed-off-by: Nas Chung Reviewed-by: Michael Tretter > --- > include/uapi/linux/videodev2.h | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index fe6b67e83751..fa2b7086e480 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -157,6 +157,10 @@ enum v4l2_buf_type { > V4L2_BUF_TYPE_PRIVATE = 0x80, > }; > > +#define V4L2_TYPE_IS_VALID(type) \ > + ((type) >= V4L2_BUF_TYPE_VIDEO_CAPTURE \ > + && (type) <= V4L2_BUF_TYPE_META_OUTPUT) > + > #define V4L2_TYPE_IS_MULTIPLANAR(type) \ > ((type) == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE \ > || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) > @@ -171,7 +175,8 @@ enum v4l2_buf_type { > || (type) == V4L2_BUF_TYPE_SDR_OUTPUT \ > || (type) == V4L2_BUF_TYPE_META_OUTPUT) > > -#define V4L2_TYPE_IS_CAPTURE(type) (!V4L2_TYPE_IS_OUTPUT(type)) > +#define V4L2_TYPE_IS_CAPTURE(type) \ > + (V4L2_TYPE_IS_VALID(type) && !V4L2_TYPE_IS_OUTPUT(type)) > > enum v4l2_tuner_type { > V4L2_TUNER_RADIO = 1, > -- > 2.25.1 > >