From: sashiko-bot@kernel.org
To: "Jiaqi Shi" <shijiaqi_develop@163.com>, imx@lists.linux.dev
Cc: Frank.Li@kernel.org, media-ci@linuxtv.org
Subject: Re: [PATCH 2/3] media: v4l2-core: add frame interval monitor helper
Date: Sat, 21 Nov 2026 14:27:47 +0000 [thread overview]
Message-ID: <sashiko-outbox-227095@kernel.org> (raw)
In-Reply-To: <20261121141412.319802-3-shijiaqi_develop@163.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] media: v4l2-fim: cross-cluster ctrl->val read in reset_fim()
--
commit 4ee73622d4ea40f9f5507b8b2948de21bfddfccc
Author: Jiaqi Shi <shijiaqi_develop@163.com>
media: v4l2-core: add frame interval monitor helper
This commit extracts the frame interval monitoring helper from the i.MX
staging driver into v4l2-core while keeping the input capture controls in
imx-media-fim.c.
> diff --git a/drivers/media/v4l2-core/v4l2-fim.c b/drivers/media/v4l2-core/v4l2-fim.c
> new file mode 100644
> index 0000000000000..57d595196663b
> --- /dev/null
> +++ b/drivers/media/v4l2-core/v4l2-fim.c
> @@ -0,0 +1,324 @@
[ ... ]
> +static void reset_fim(struct v4l2_fim *fim, bool curval)
> +{
> + struct v4l2_ctrl *en = fim->ctrl[FIM_CL_ENABLE];
> + struct v4l2_ctrl *num = fim->ctrl[FIM_CL_NUM];
> + struct v4l2_ctrl *skip = fim->ctrl[FIM_CL_NUM_SKIP];
> + struct v4l2_ctrl *tol_min = fim->ctrl[FIM_CL_TOLERANCE_MIN];
> + struct v4l2_ctrl *tol_max = fim->ctrl[FIM_CL_TOLERANCE_MAX];
> +
> + if (fim->config.external_timestamp)
> + fim->external_timestamp =
> + fim->config.external_timestamp(fim->config.priv, curval);
> +
> + if (curval) {
> + fim->enabled = en->cur.val;
> + fim->num_avg = num->cur.val;
> + fim->num_skip = skip->cur.val;
> + fim->tolerance_min = tol_min->cur.val;
> + fim->tolerance_max = tol_max->cur.val;
> + } else {
> + fim->enabled = en->val;
> + fim->num_avg = num->val;
> + fim->num_skip = skip->val;
> + fim->tolerance_min = tol_min->val;
> + fim->tolerance_max = tol_max->val;
> + }
[Severity: Medium]
Can reset_fim() and fim->config.external_timestamp() read uncommitted
ctrl->val values across separate control clusters when curval is false?
v4l2_fim_init() clusters the five core FIM controls into fim->ctrl, while
imx_media_fim_init() clusters the two input capture controls separately
into fim->icap_ctrl. The V4L2 control framework only synchronizes
ctrl->val with ctrl->cur.val for the cluster currently being tried or set,
and leaves trial or rejected values in ctrl->val after VIDIOC_TRY_EXT_CTRLS
or a failed s_ctrl.
If setting V4L2_CID_IMX_FIM_ICAP_EDGE while streaming fails with -EBUSY
(or is tried via VIDIOC_TRY_EXT_CTRLS), icap_edge->val retains the
uncommitted value. A subsequent update to any core FIM control calls
fim_s_ctrl() -> reset_fim(fim, false) ->
imx_fim_external_timestamp(..., false), which reads icap_edge->val and
enables external_timestamp mode during active streaming, disabling EOF
monitoring. Conversely, updating fim->icap_ctrl calls
v4l2_fim_reset(fim->core, false), causing reset_fim() to read uncommitted
->val fields from the core fim->ctrl cluster.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261121141412.319802-1-shijiaqi_develop@163.com?part=2
next prev parent reply other threads:[~2026-11-21 14:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-21 14:14 [PATCH 0/3] media: imx: staging cleanup and FIM export to v4l2-core Jiaqi Shi
2026-11-21 14:14 ` [PATCH 1/3] media: imx: remove legacy video node control and format handling Jiaqi Shi
2026-11-21 14:40 ` sashiko-bot
2026-11-21 14:14 ` [PATCH 2/3] media: v4l2-core: add frame interval monitor helper Jiaqi Shi
2026-11-21 14:27 ` sashiko-bot [this message]
2026-11-21 14:14 ` [PATCH 3/3] media: imx: allow setting FIM input capture channel Jiaqi Shi
2026-11-21 14:24 ` sashiko-bot
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=sashiko-outbox-227095@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=media-ci@linuxtv.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=shijiaqi_develop@163.com \
/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