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 107B61E480; Mon, 23 Jun 2025 13:39:03 +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=1750685944; cv=none; b=AOTFc1r0f4oXBTNrWwfG+ykEa+W8//Alun2H4ehw7dajLjVeAy6JQsiYXDYluK6fhojY5n1LhZ6EkpSlQhruTdratdicsCjDT9s6RzjCU5VC/H7RkQ8V7/gjyPbg9KEBNnYFbJ5ODozmPf/9TT8hlf1aCQuwgyROohQ5Wl9VxCw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750685944; c=relaxed/simple; bh=52U7i5tTdeK4hebS3AriLJUl8CpW3Ide2MdeesJ8bVM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YMSgqNlYQCEIG0HDIjEQtSQ5xjEmz9gqckkPHXkqvagVnq2R0bePMwVHVi14e2T29C2iavgMBZ5Sb9eXqE9/Hx8i/bIFIq/Pde5UQnXKzCttMvUBUkTvEV9wNAyjxEmdRl+sAzdGzDVNL5tM7LY3Iz0sLmuPgBVDYkFZRqshcHY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Ofs4P2uy; 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="Ofs4P2uy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3C999C4CEEA; Mon, 23 Jun 2025 13:39:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1750685943; bh=52U7i5tTdeK4hebS3AriLJUl8CpW3Ide2MdeesJ8bVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ofs4P2uy0nyN9+FMiOTxcmXY9uhHYNpjlBpOiJIsAjp4SN1qe1R1bc1StSeRXNjE/ Yc64hLn0qIKWIu5qlgW3GZ7OYROAdKaGf/S5dxnYUNkzBF12cHiRt65VuJGkSgIo/b rEBkTJdPM7QjJhdpPlBl0zv3PLNmgShtwtmqRv4s= 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 6.15 272/592] media: uapi: v4l: Change V4L2_TYPE_IS_CAPTURE condition Date: Mon, 23 Jun 2025 15:03:50 +0200 Message-ID: <20250623130706.798554925@linuxfoundation.org> X-Mailer: git-send-email 2.50.0 In-Reply-To: <20250623130700.210182694@linuxfoundation.org> References: <20250623130700.210182694@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.15-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 b0e1f660c5f72..af86ece741e94 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