From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8E39A221FD2; Mon, 23 Jun 2025 21:34:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714487; cv=none; b=nhiN/8ImjJfmD3IC8A2lPshlEZKT2cZ/grkGxtLyDFSfOShIJ1h0V4RE93J0EtdqBog2XVv4calHUo684Udm49UTxTtiGqtgTSjFFxSQq+y+PwkTLEh9iQUmM1S1MTS3iu6RPnrZSUj+hgENpt3+FOT6ThdgAMWXZGrMwkSy7O0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750714487; c=relaxed/simple; bh=T3q32kSZ746yuURuZafRTuoZcKRxGYSQh90zmeDpsxM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LNNiw2sJHhh3XGR+uH4BVMcoCALOH8HySW4eyOrjSul9JP6nXHSEinp/Pu2XAtcmO4DzdW8m9uWxneltvAVDYIeT9u5RGsUTjCauTJSJjWGFVw39+KhOhG/YtHX8P8f08DJAHB9QF5SW5aWFMkLi4oBRjA5uOaraV9miIkgvako= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=cuNZkGLu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="cuNZkGLu" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 26DF9C4CEEA; Mon, 23 Jun 2025 21:34:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750714487; bh=T3q32kSZ746yuURuZafRTuoZcKRxGYSQh90zmeDpsxM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cuNZkGLuYQcFEgOI2Q3kpXWSOZsSVpbtfKo4I3gv2ABWMdPdhcclY1EgxxqcAkXqJ cnvLKXifVDpX/7MJbp1GLCCgWvtFqNXKqUJbQuIYX1oER2QhlpiYJuNPoDjM1CWhqh 6YE9Y1yOmIyNuGA5GiflxQ3ywpuWDzi3Hq8qOPoU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Nas Chung , Michael Tretter , Sebastian Fricke , Hans Verkuil , Sasha Levin Subject: [PATCH 5.10 231/355] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Date: Mon, 23 Jun 2025 15:07:12 +0200 Message-ID: <20250623130633.694406580@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130626.716971725@linuxfoundation.org> References: <20250623130626.716971725@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nas Chung [ Upstream commit ad2698efce37e910dcf3c3914263e6cb3e86f8cd ] Explicitly compare a buffer type only with valid buffer types, to avoid matching a buffer type outside of the valid buffer type set. Signed-off-by: Nas Chung Reviewed-by: Michael Tretter Signed-off-by: Sebastian Fricke Signed-off-by: Hans Verkuil Signed-off-by: Sasha Levin --- include/uapi/linux/videodev2.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index a0671e510bc4a..1ee25344c0760 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -153,10 +153,18 @@ enum v4l2_buf_type { V4L2_BUF_TYPE_SDR_OUTPUT = 12, V4L2_BUF_TYPE_META_CAPTURE = 13, V4L2_BUF_TYPE_META_OUTPUT = 14, + /* + * Note: V4L2_TYPE_IS_VALID and V4L2_TYPE_IS_OUTPUT must + * be updated if a new type is added. + */ /* Deprecated, do not use */ 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) @@ -170,7 +178,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.39.5