mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Riesch via B4 Relay <devnull+michael.riesch.collabora.com@kernel.org>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Hans Verkuil <hverkuil+cisco@kernel.org>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Mehdi Djait <mehdi.djait@linux.intel.com>,
	 Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	Frank Li <Frank.Li@nxp.com>,
	 Dan Carpenter <dan.carpenter@linaro.org>
Cc: Collabora Kernel Team <kernel@collabora.com>,
	 linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 stable@kernel.org, Michael Riesch <michael.riesch@collabora.com>
Subject: [PATCH 1/2] media: synopsys: csi2rx: fix out-of-bounds check for formats array
Date: Mon, 16 Feb 2026 13:28:47 +0100	[thread overview]
Message-ID: <20260216-snps-csi2rx-v1-1-747bc7408f87@collabora.com> (raw)
In-Reply-To: <20260216-snps-csi2rx-v1-0-747bc7408f87@collabora.com>

From: Michael Riesch <michael.riesch@collabora.com>

The out-of-bounds check for the format array is off by one. Fix the
check.

Fixes: 355a11004066 ("media: synopsys: add driver for the designware mipi csi-2 receiver")
Cc: stable@kernel.org
Suggested-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Michael Riesch <michael.riesch@collabora.com>
---
 drivers/media/platform/synopsys/dw-mipi-csi2rx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
index 170346ae1a59..4d96171a650b 100644
--- a/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
+++ b/drivers/media/platform/synopsys/dw-mipi-csi2rx.c
@@ -301,7 +301,7 @@ dw_mipi_csi2rx_enum_mbus_code(struct v4l2_subdev *sd,
 
 		return 0;
 	case DW_MIPI_CSI2RX_PAD_SINK:
-		if (code->index > csi2->formats_num)
+		if (code->index >= csi2->formats_num)
 			return -EINVAL;
 
 		code->code = csi2->formats[code->index].code;

-- 
2.39.5



  reply	other threads:[~2026-02-16 12:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 12:28 [PATCH 0/2] media: synopsys: csi2rx: various fixes Michael Riesch via B4 Relay
2026-02-16 12:28 ` Michael Riesch via B4 Relay [this message]
2026-02-17 15:49   ` [PATCH 1/2] media: synopsys: csi2rx: fix out-of-bounds check for formats array Frank Li
2026-02-16 12:28 ` [PATCH 2/2] media: synopsys: csi2rx: add missing kconfig dependency Michael Riesch via B4 Relay
2026-02-17 15:49   ` [PATCH 2/2] media: synopsys: csi2rx: add missing kconfig dependencyy Frank Li

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=20260216-snps-csi2rx-v1-1-747bc7408f87@collabora.com \
    --to=devnull+michael.riesch.collabora.com@kernel.org \
    --cc=Frank.Li@nxp.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=dan.carpenter@linaro.org \
    --cc=hverkuil+cisco@kernel.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mehdi.djait@linux.intel.com \
    --cc=michael.riesch@collabora.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=stable@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

all inboxes | Powered by JetHome®