From: sashiko-bot@kernel.org
To: "Guoniu Zhou" <guoniu.zhou@oss.nxp.com>
Cc: imx@lists.linux.dev, Frank.Li@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH v2 2/6] media: nxp: imx8-isi: Add stream ID validation for crossbar routing
Date: Mon, 20 Jul 2026 03:42:32 +0000 [thread overview]
Message-ID: <20260720034232.CC2331F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260720-isi-v2-2-45845bc5d4fa@oss.nxp.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The driver uses the `BIT()` macro on 64-bit stream masks (`source_streams` and `sink_streams`), which will cause undefined behavior on 32-bit platforms if the stream ID exceeds 31.
--
--- Patch [2]: [PATCH v2 2/6] media: nxp: imx8-isi: Add stream ID validation for crossbar routing ---
commit d756aed8e216cd683009378d45743e6351a90389
Author: Guoniu Zhou <guoniu.zhou@oss.nxp.com>
media: nxp: imx8-isi: Add stream ID validation for crossbar routing
This commit adds validation to enforce hardware constraints in the crossbar
routing configuration. It ensures that the SOURCE stream is strictly set to
0, as ISI pipes are hardcoded to stream 0. It also ensures memory input
respects routing limitations to the first pipeline.
> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> index 84871bceb31db..328d08a278eaf 100644
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> @@ -106,8 +106,20 @@ static int __mxc_isi_crossbar_set_routing(struct v4l2_subdev *sd,
> if (ret)
> return ret;
>
> - /* The memory input can be routed to the first pipeline only. */
> + /*
> + * Validate routes against hardware constraints:
> + * - SOURCE stream must be 0 (pipes are hardcoded to stream 0)
> + * - Memory input can only route to the first pipeline
> + */
> for_each_active_route(routing, route) {
> + if (route->source_stream != 0) {
[Severity: High]
This is a pre-existing issue, but while reviewing this stream ID validation,
I noticed a potential bit shift overflow regarding stream IDs in the related
mxc_isi_crossbar_xlate_streams() function:
drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c:mxc_isi_crossbar_xlate_streams() {
...
if (!(source_streams & BIT(route->source_stream)))
...
sink_streams |= BIT(route->sink_stream);
...
}
Does this code cause undefined behavior on 32-bit platforms if userspace
provides a V4L2 routing configuration with a sink_stream or source_stream
greater than or equal to 32?
Since the BIT() macro evaluates to a 32-bit value on 32-bit architectures,
shifting it by 32 or more results in a bit shift overflow. This could allow
the compiler to make unsafe optimization assumptions, potentially corrupting
the 64-bit stream mask logic.
Should this use BIT_ULL() instead?
> + dev_dbg(xbar->isi->dev,
> + "route to pipe %u must use source_stream=0, got %u\n",
> + route->source_pad - xbar->num_sinks,
> + route->source_stream);
> + return -ENXIO;
> + }
> +
> if (route->sink_pad == xbar->num_sinks - 1 &&
> route->source_pad != xbar->num_sinks) {
> dev_dbg(xbar->isi->dev,
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260720-isi-v2-0-45845bc5d4fa@oss.nxp.com?part=2
next prev parent reply other threads:[~2026-07-20 3:42 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-20 3:34 [PATCH v2 0/6] imx8-isi: Bug fixes and format support enhancements Guoniu Zhou
2026-07-20 3:34 ` [PATCH v2 1/6] media: nxp: imx8-isi: Fix stream ID validation bypass in crossbar routing Guoniu Zhou
2026-07-20 3:43 ` sashiko-bot
2026-07-20 15:09 ` Frank Li
2026-07-20 17:30 ` Laurent Pinchart
2026-07-20 3:34 ` [PATCH v2 2/6] media: nxp: imx8-isi: Add stream ID validation for " Guoniu Zhou
2026-07-20 3:42 ` sashiko-bot [this message]
2026-07-20 15:11 ` Frank Li
2026-07-20 17:32 ` Laurent Pinchart
2026-07-20 3:34 ` [PATCH v2 3/6] media: nxp: imx8-isi: Fix per-stream reference counting for multiplexed streams Guoniu Zhou
2026-07-20 3:42 ` sashiko-bot
2026-07-20 15:34 ` Frank Li
2026-07-20 21:03 ` Laurent Pinchart
2026-07-20 3:34 ` [PATCH v2 4/6] media: nxp: imx8-isi: Add 16-bit raw Bayer format support guoniu.zhou
2026-07-20 21:15 ` Laurent Pinchart
2026-07-20 3:34 ` [PATCH v2 5/6] media: nxp: imx8-isi: Correct color map between V4L2 and ISI Guoniu Zhou
2026-07-20 15:37 ` Frank Li
2026-07-20 17:40 ` Laurent Pinchart
2026-07-20 23:18 ` Laurent Pinchart
2026-07-20 3:34 ` [PATCH v2 6/6] media: nxp: imx8-isi: Add additional 32-bit RGB format support Guoniu Zhou
2026-07-21 0:21 ` Laurent Pinchart
2026-07-21 0:32 ` [PATCH v2 0/6] imx8-isi: Bug fixes and format support enhancements Laurent Pinchart
2026-07-21 0:35 ` Laurent Pinchart
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=20260720034232.CC2331F00A3A@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=media-ci@linuxtv.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox