Linux Media Controller development
 help / color / mirror / Atom feed
From: David Carlier <devnexen@gmail.com>
To: linux-media@vger.kernel.org
Cc: Daniel Scally <dan.scally@ideasonboard.com>,
	Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] media: mali-c55: Never match an unset media bus code
Date: Sat,  5 Dec 2026 21:27:56 +0000	[thread overview]
Message-ID: <20261205212756.16953-2-devnexen@gmail.com> (raw)
In-Reply-To: <20261205212756.16953-1-devnexen@gmail.com>

Formats with a single media bus code leave the second mbus_codes[] slot
at zero, so a code of 0 matches all of them. Nothing sets a zero code
anymore, but link validation should not accept one. Reject it up front.

Signed-off-by: David Carlier <devnexen@gmail.com>
---
 drivers/media/platform/arm/mali-c55/mali-c55-capture.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
index d6f155dd5255..0bb85f6bda3e 100644
--- a/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
+++ b/drivers/media/platform/arm/mali-c55/mali-c55-capture.c
@@ -233,6 +233,10 @@ mali_c55_mbus_code_can_produce_fmt(const struct mali_c55_format_info *fmt,
 {
 	unsigned int i;
 
+	/* Unused mbus_codes[] slots are zero, never match them. */
+	if (!code)
+		return false;
+
 	for (i = 0; i < ARRAY_SIZE(fmt->mbus_codes); i++) {
 		if (fmt->mbus_codes[i] == code)
 			return true;
-- 
2.55.0


      reply	other threads:[~2026-12-05 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 21:27 [PATCH 1/2] media: mali-c55: Fix the resizer source code for RGB bypass David Carlier
2026-12-05 21:27 ` David Carlier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205212756.16953-2-devnexen@gmail.com \
    --to=devnexen@gmail.com \
    --cc=dan.scally@ideasonboard.com \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox