All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: guoniu.zhou@oss.nxp.com
Cc: Frank.Li@kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH 3/5] media: nxp: imx8-isi: Add 16-bit raw Bayer format support
Date: Mon, 29 Jun 2026 07:56:40 +0000	[thread overview]
Message-ID: <20260629075641.338621F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260629-isi-v1-3-deebfdb1b07b@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Crossbar routing artificially restricts sink_stream IDs to the number of available pipelines, breaking valid CSI-2 Virtual Channel routing.
--

commit 7b27c9929d91d2f4cfef36db9983af8a9df1006d
Author: Laurentiu Palcu <laurentiu.palcu@oss.nxp.com>

media: nxp: imx8-isi: Add 16-bit raw Bayer format support
    
Add support for 16-bit raw Bayer formats (SBGGR16, SGBRG16, SGRBG16,
SRGGB16) to both the pipeline subdev and video capture interface.

These formats are commonly used by high-end image sensors that output
16-bit raw data, enabling the ISI to process and capture full dynamic
range from such sensors.

> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> index 2d0843c86534c..e58925d71164d 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-pipe.c

[ ... ]

While reviewing this series, I noticed an issue in
drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c. This wasn't
introduced by this specific patch, but earlier in the series by the commits
"media: nxp: imx8-isi: Fix stream ID validation bypass in crossbar routing"
and "media: nxp: imx8-isi: Fix per-stream reference counting for multiplexed
streams".

drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c:__mxc_isi_crossbar_set_routing() {
        ...
		if (route->sink_stream >= xbar->num_sources) {
			dev_dbg(xbar->isi->dev,
				"sink_stream %u exceeds hardware limit %u\n",
				route->sink_stream, xbar->num_sources - 1);
			return -ENXIO;
		}
        ...
}

[Severity: High]
Does this validation artificially restrict sink_stream IDs to the number of
available pipelines?  On SoCs with a single pipeline (like i.MX8MN where
num_sources=1), this appears to reject valid CSI-2 Virtual Channel routing
for any stream ID other than 0 (e.g. VC1) with -ENXIO.

Additionally, this logic seems to carry over into the stream tracking arrays:

drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c:mxc_isi_crossbar_enable_streams() {
        ...
	/* Increment reference count for all requested streams */
	for (stream = 0; stream < xbar->num_sources; stream++) {
		if (!(sink_streams & BIT(stream)))
			continue;

		input->enabled_count[stream]++;
	}
        ...
}

[Severity: High]
Since this loop is bounded by xbar->num_sources, does it fail to track valid
streams that are >= num_sources?

drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c:mxc_isi_stream_counters_alloc() {
        ...
	for (i = 0; i < xbar->num_sinks; ++i) {
		struct mxc_isi_input *input = &xbar->inputs[i];

		input->enabled_count = kcalloc(xbar->num_sources,
					       sizeof(*input->enabled_count),
					       GFP_KERNEL);
        ...
}

[Severity: High]
Is the enabled_count array incorrectly sized here? It allocates based on
xbar->num_sources instead of the maximum supported stream ID. If validation
were bypassed, would this lead to out-of-bounds tracking for streams
>= num_sources, given that the u64 bitmask implies support for up to 64
streams?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260629-isi-v1-0-deebfdb1b07b@oss.nxp.com?part=3

  reply	other threads:[~2026-06-29  7:56 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29  7:44 [PATCH 0/5] imx8-isi: Bug fixes and format support enhancements Guoniu Zhou
2026-06-29  7:44 ` [PATCH 1/5] media: nxp: imx8-isi: Fix stream ID validation bypass in crossbar routing Guoniu Zhou
2026-06-29  7:51   ` sashiko-bot
2026-06-29 14:33   ` Frank Li
2026-06-29  7:44 ` [PATCH 2/5] media: nxp: imx8-isi: Fix per-stream reference counting for multiplexed streams Guoniu Zhou
2026-06-29 14:55   ` Frank Li
2026-06-29  7:44 ` [PATCH 3/5] media: nxp: imx8-isi: Add 16-bit raw Bayer format support guoniu.zhou
2026-06-29  7:56   ` sashiko-bot [this message]
2026-06-29 14:57   ` Frank Li
2026-06-29  7:44 ` [PATCH 4/5] media: nxp: imx8-isi: Correct color map between V4L2 and ISI Guoniu Zhou
2026-06-29 15:08   ` Frank Li
2026-06-29  7:44 ` [PATCH 5/5] media: nxp: imx8-isi: Add additional 32-bit RGB format support Guoniu Zhou
2026-06-29 15:10   ` 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=20260629075641.338621F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=guoniu.zhou@oss.nxp.com \
    --cc=imx@lists.linux.dev \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.