All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guoniu Zhou" <guoniu.zhou@oss.nxp.com>
Cc: Frank.Li@kernel.org, imx@lists.linux.dev, media-ci@linuxtv.org
Subject: Re: [PATCH v5 1/4] media: nxp: imx8-isi: Use BIT_ULL() for 64-bit stream masks
Date: Tue, 28 Jul 2026 07:10:30 +0000	[thread overview]
Message-ID: <20260728071030.961E71F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260728-isi-v5-1-1d22ab91602a@oss.nxp.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Routing validation checks the old routing state instead of the newly requested routing.
- [High] Stream translation silently overwrites sink pad and mixes streams from different inputs, violating hardware assumptions.
--

--- Patch [1]: [PATCH v5 1/4] media: nxp: imx8-isi: Use BIT_ULL() for 64-bit stream masks ---
commit 4ed3fcf5e835032b4860a0f0d335cd63bb0bee70
Author: Guoniu Zhou <guoniu.zhou@oss.nxp.com>

media: nxp: imx8-isi: Use BIT_ULL() for 64-bit stream masks

This commit replaces BIT() with BIT_ULL() for 64-bit stream masks to avoid
incorrect results on 32-bit architectures when stream IDs are 32 or greater.

> diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c
> @@ -145,10 +145,10 @@ mxc_isi_crossbar_xlate_streams(struct mxc_isi_crossbar *xbar,
>  	 */
>  	for_each_active_route(&state->routing, route) {
>  		if (route->source_pad != source_pad ||
> -		    !(source_streams & BIT(route->source_stream)))
> +		    !(source_streams & BIT_ULL(route->source_stream)))
>  			continue;
>  
> -		sink_streams |= BIT(route->sink_stream);
> +		sink_streams |= BIT_ULL(route->sink_stream);
>  		sink_pad = route->sink_pad;

[Severity: High]
This isn't a regression introduced by this patch, but a pre-existing issue.
Could this stream translation silently overwrite the sink pad and mix streams
from different inputs?

In mxc_isi_crossbar_xlate_streams(), the loop iterates over all routes matching
the source pad and source_streams mask. It appears to blindly overwrite
sink_pad and bitwise-OR the sink_streams without checking if they originate
from the same sink pad.

If userspace sets up routing where streams from different sink pads are routed
to the same source pad on different stream ids, could this cause only the last
overwritten sink_pad to be returned?

This might lead to only one remote subdevice being enabled while abandoning
others, passing an invalidly mixed stream mask to the enabled device.

>  	}
>  

As an additional observation in this file:

[Severity: High]
This isn't a regression introduced by this patch, but a pre-existing issue.
Is the old routing state checked instead of the newly requested routing during
validation?

In __mxc_isi_crossbar_set_routing():

    for_each_active_route(&state->routing, route) {

When userspace calls VIDIOC_SUBDEV_S_ROUTING with an invalid route mapping the
memory input to a pipeline other than the first, does this validate the
request against the old routing table (&state->routing) rather than the new
routing array passed as a parameter?

Since the old table does not contain the invalid route yet, it appears this
check might pass incorrectly and allow impossible hardware configurations to
be accepted.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260728-isi-v5-0-1d22ab91602a@oss.nxp.com?part=1

  reply	other threads:[~2026-07-28  7:10 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28  6:58 [PATCH v5 0/4] imx8-isi: Format support enhancements Guoniu Zhou
2026-07-28  6:58 ` [PATCH v5 1/4] media: nxp: imx8-isi: Use BIT_ULL() for 64-bit stream masks Guoniu Zhou
2026-07-28  7:10   ` sashiko-bot [this message]
2026-07-28 14:08   ` Loic Poulain
2026-07-28 14:54   ` Frank Li
2026-07-28  6:58 ` [PATCH v5 2/4] media: nxp: imx8-isi: Implement per-stream reference counting for multiplexed streams Guoniu Zhou
2026-07-28 14:57   ` Frank Li
2026-07-28  6:58 ` [PATCH v5 3/4] media: nxp: imx8-isi: Add 16-bit raw Bayer format support guoniu.zhou
2026-07-28 14:11   ` Loic Poulain
2026-07-28  6:58 ` [PATCH v5 4/4] media: nxp: imx8-isi: Add additional 32-bit RGB " Guoniu Zhou
2026-07-28  7:13   ` sashiko-bot
2026-07-28 14:13   ` Loic Poulain

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=20260728071030.961E71F000E9@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 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.