From: sashiko-bot@kernel.org
To: "Sakari Ailus" <sakari.ailus@linux.intel.com>
Cc: linux-media@vger.kernel.org
Subject: Re: [PATCH v5 03/10] media: imx219: Account rate_factor in setting upper exposure limit
Date: Sun, 07 Jun 2026 22:05:54 +0000 [thread overview]
Message-ID: <20260607220554.B4F711F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260607215356.842932-4-sakari.ailus@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The patch updates the exposure maximum limit calculation in `imx219_set_ctrl()` to account for analog binning (initially via `rate_factor`, later rewritten using `bin_hv` in commit "media: imx219: Fix vertical blanking and exposure for analogue binning"), but misses the identical calculation in `imx219_set_pad_format()`. This logic error persists through the end of the series. When a binned format is set, `__v4l2_ctrl_s_ctrl(vblank)` correctly updates the exposure limit via `imx219_set_ctrl()`. However, immediately afterward, `imx219_set_pad_format()` recalculates and overwrites `exposure_max` using the unscaled formula `mode->fll_def - IMX219_EXPOSURE_OFFSET` (instead of `(mode->fll_def / bin_hv) - IMX219_EXPOSURE_OFFSET`). This allows userspace to set an exposure time greater than the frame length, violating sensor hardware constraints.
--
commit 5813edc0a3e8ed48f469607d03f8489ba7a6eb19
Author: Sakari Ailus <sakari.ailus@linux.intel.com>
media: imx219: Account rate_factor in setting upper exposure limit
This commit modifies the maximum exposure time calculation in imx219_set_ctrl()
to account for the rate_factor multiplier when analog binning is used. This
ensures the sensor's exposure time margin is correctly respected.
> diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c
> index d8fe7db18b6cd..e681f80f9e3ef 100644
> --- a/drivers/media/i2c/imx219.c
> +++ b/drivers/media/i2c/imx219.c
> @@ -451,7 +451,8 @@ static int imx219_set_ctrl(struct v4l2_ctrl *ctrl)
> int exposure_max, exposure_def;
>
> /* Update max exposure while meeting expected vblanking */
> - exposure_max = format->height + ctrl->val - IMX219_EXPOSURE_OFFSET;
> + exposure_max = format->height + ctrl->val -
> + IMX219_EXPOSURE_OFFSET * rate_factor;
[Severity: High]
This is a pre-existing issue, but does imx219_set_pad_format() also need to
be updated to apply scaling to its exposure maximum calculation?
When a binned format is set, __v4l2_ctrl_s_ctrl(vblank) correctly updates
the exposure limit here in imx219_set_ctrl(). However, immediately afterward,
imx219_set_pad_format() recalculates and overwrites exposure_max using the
unscaled formula:
drivers/media/i2c/imx219.c:imx219_set_pad_format() {
...
/* Update max exposure while meeting expected vblanking */
exposure_max = mode->fll_def - IMX219_EXPOSURE_OFFSET;
exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
exposure_max : IMX219_EXPOSURE_DEFAULT;
ret = __v4l2_ctrl_modify_range(imx219->exposure,
imx219->exposure->minimum,
exposure_max,
imx219->exposure->step,
exposure_def);
...
}
It appears this logic error persists until it is rewritten using bin_hv in
the later commit "media: imx219: Fix vertical blanking and exposure for
analogue binning".
Until then, does this allow userspace to set an exposure time greater than
the actual programmed frame length, violating sensor hardware constraints and
potentially resulting in sensor streaming failures or I2C timeouts?
> exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ?
> exposure_max : IMX219_EXPOSURE_DEFAULT;
> ret = __v4l2_ctrl_modify_range(imx219->exposure,
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260607215356.842932-1-sakari.ailus@linux.intel.com?part=3
next prev parent reply other threads:[~2026-06-07 22:05 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-07 21:53 [PATCH v5 00/10] Metadata series preparation Sakari Ailus
2026-06-07 21:53 ` [PATCH v5 01/10] media: Documentation: Improve pixel rate calculation documentation Sakari Ailus
2026-06-07 21:53 ` [PATCH v5 02/10] media: imx219: Scale the vblank limits according to rate_factor Sakari Ailus
2026-06-08 7:26 ` Laurent Pinchart
2026-06-07 21:53 ` [PATCH v5 03/10] media: imx219: Account rate_factor in setting upper exposure limit Sakari Ailus
2026-06-07 22:05 ` sashiko-bot [this message]
2026-06-08 9:06 ` Laurent Pinchart
2026-06-07 21:53 ` [PATCH v5 04/10] media: imx219: Make control handler ops for PIXEL_RATE NULL Sakari Ailus
2026-06-08 7:36 ` Laurent Pinchart
2026-06-08 7:53 ` Jacopo Mondi
2026-06-08 8:03 ` Laurent Pinchart
2026-06-08 8:14 ` Sakari Ailus
2026-06-08 8:24 ` Laurent Pinchart
2026-06-08 10:21 ` Sakari Ailus
2026-06-08 10:27 ` Laurent Pinchart
2026-06-07 21:53 ` [PATCH v5 05/10] media: imx219: Rename "binning" as "bin_hv" in imx219_set_pad_format Sakari Ailus
2026-06-07 21:53 ` [PATCH v5 06/10] media: imx219: Fix vertical blanking and exposure for analogue binning Sakari Ailus
2026-06-07 22:07 ` sashiko-bot
2026-06-08 6:58 ` Jacopo Mondi
2026-06-08 9:10 ` Laurent Pinchart
2026-06-08 10:31 ` Jai Luthra
2026-06-08 11:19 ` Jai Luthra
2026-06-07 21:53 ` [PATCH v5 07/10] media: Improve enable_streams and disable_streams documentation Sakari Ailus
2026-06-08 9:29 ` Laurent Pinchart
2026-06-07 21:53 ` [PATCH v5 08/10] media: v4l2-subdev: Move subdev client capabilities into a new struct Sakari Ailus
2026-06-08 9:34 ` Laurent Pinchart
2026-06-07 21:53 ` [PATCH v5 09/10] media: v4l2-subdev: Add v4l2_subdev_get_fmt_ci() Sakari Ailus
2026-06-08 7:48 ` Laurent Pinchart
2026-06-07 21:53 ` [PATCH v5 10/10] media: v4l2-subdev: Add struct v4l2_subdev_client_info pointer to pad ops Sakari Ailus
2026-06-08 10:16 ` 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=20260607220554.B4F711F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@linux.intel.com \
--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.