From: sashiko-bot@kernel.org
To: "Bhavin Sharma" <bhavin.sharma@siliconsignals.io>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org,
media-ci@linuxtv.org
Subject: Re: [PATCH 2/2] media: i2c: add os05e10 image sensor driver
Date: Mon, 23 Nov 2026 15:09:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-229499@kernel.org> (raw)
In-Reply-To: <20261123145445.66636-3-bhavin.sharma@siliconsignals.io>
Thank you for your contribution! Sashiko AI review found 5 potential
issues to consider:
- [High] media: i2c: os05e10: off-by-one bounds check in
os05e10_enum_mbus_code()
- [Medium] media: i2c: os05e10: 32-bit integer overflow in
os05e10_pixel_rate()
- [Medium] media: i2c: os05e10: missing CSI-2 lane check in
os05e10_parse_endpoint()
- [Medium] media: i2c: os05e10: missing V4L2_CID_HBLANK in
os05e10_init_controls()
- [Low] media: i2c: os05e10: wrong sensor name and Bayer format in
commit message
--
commit 0e387b1eefc19bf74866651b58cb5763696e11ef
Author: Bhavin Sharma <bhavin.sharma@siliconsignals.io>
media: i2c: add os05e10 image sensor driver
This commit adds a V4L2 subdevice driver for the OmniVision OS05E10 CMOS
image sensor, supporting 2592x1944 resolution at 60fps with manual exposure,
gain, and vblank controls.
> Add a v4l2 subdevice driver for the Omnivision os02g10 sensor.
>
> The Omnivision os05e10 is a CMOS image sensor with an active array size of
> 2592 x 1944.
>
> The following features are supported:
> - Manual exposure an gain control support
> - vblank control support
> - Supported resolution: 2592 x 1944 @ 60fps (SBGGR10)
[Severity: Low]
The commit message refers to the os02g10 sensor in the first line and states
that the supported format is SBGGR10, whereas os05e10_mbus_codes[] exposes
MEDIA_BUS_FMT_SRGGB10_1X10. In addition, the new VIDEO_OS05E10 entry in
drivers/media/i2c/Kconfig is indented with spaces instead of tabs, and
os05e10_common_regs[] in drivers/media/i2c/os05e10.c writes CCI_REG8(0xb88)
twice (0x47 and then 0x43).
> diff --git a/drivers/media/i2c/os05e10.c b/drivers/media/i2c/os05e10.c
> new file mode 100644
> index 0000000000000..736061b6c1b0d
> --- /dev/null
> +++ b/drivers/media/i2c/os05e10.c
> @@ -0,0 +1,969 @@
[ ... ]
> +/* Read-only registers */
> +#define OS05E10_REG_VTS CCI_REG24(0x134)
> +#define OS05E10_REG_HTS CCI_REG16(0x137)
> +
> +#define OS05E10_LINK_FREQ_720MHZ (720 * HZ_PER_MHZ)
> +#define OS05E10_DATA_LANES 4
[ ... ]
> +static const u32 os05e10_mbus_codes[] = {
> + MEDIA_BUS_FMT_SRGGB10_1X10,
> +};
[ ... ]
> +static u64 os05e10_pixel_rate(const struct os05e10_mode *mode)
> +{
> + /* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */
> + return div_u64(OS05E10_LINK_FREQ_720MHZ * 2 * OS05E10_DATA_LANES,
> + mode->bpp);
> +}
[Severity: Medium]
Does the dividend in os05e10_pixel_rate() overflow on 32-bit architectures?
HZ_PER_MHZ is 1000000UL, so OS05E10_LINK_FREQ_720MHZ * 2 * OS05E10_DATA_LANES
is evaluated in 32-bit unsigned long arithmetic on 32-bit targets before
widening to u64 for div_u64(). 720000000UL * 8 wraps 32 bits, triggering a
-Woverflow compiler warning and computing a pixel rate of 146503270 Hz
instead of 576000000 Hz.
> +static int os05e10_init_controls(struct os05e10 *os05e10)
> +{
[ ... ]
> + vblank_def = mode->vts - mode->height;
> + os05e10->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &os05e10_ctrl_ops,
> + V4L2_CID_VBLANK,
> + OS05E10_VTS_BASE - mode->height,
> + OS05E10_VTS_BASE - mode->height +
> + OS05E10_VBLANK_MAX,
> + 1, vblank_def);
> +
> + exp_max = mode->vts - OS05E10_EXPOSURE_MARGIN;
> + os05e10->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &os05e10_ctrl_ops,
> + V4L2_CID_EXPOSURE,
> + OS05E10_EXPOSURE_MIN, exp_max,
> + OS05E10_EXPOSURE_STEP,
> + mode->exp);
[Severity: Medium]
Should os05e10_init_controls() also register a V4L2_CID_HBLANK control (and
are the unused OS05E10_REG_VTS and OS05E10_REG_HTS macros leftovers from
that)? Without V4L2_CID_HBLANK alongside V4L2_CID_VBLANK and
V4L2_CID_PIXEL_RATE, userspace camera stacks cannot compute the horizontal
line duration or frame interval.
[ ... ]
> +static int os05e10_enum_mbus_code(struct v4l2_subdev *sd,
> + struct v4l2_subdev_state *sd_state,
> + struct v4l2_subdev_mbus_code_enum *code)
> +{
> + if (code->index > ARRAY_SIZE(os05e10_mbus_codes))
> + return -EINVAL;
> +
> + code->code = os05e10_mbus_codes[code->index];
> +
> + return 0;
> +}
[Severity: High]
Does os05e10_enum_mbus_code() read one element past the end of
os05e10_mbus_codes[] when code->index == ARRAY_SIZE(os05e10_mbus_codes)?
Standard V4L2 format enumeration increments code->index from 0 until
-EINVAL, so code->index == 1 passes the > check, reads os05e10_mbus_codes[1]
out of bounds, and returns 0 with adjacent .rodata copied to userspace.
[ ... ]
> +static int os05e10_parse_endpoint(struct os05e10 *os05e10)
> +{
> + struct v4l2_fwnode_endpoint bus_cfg = {
> + .bus_type = V4L2_MBUS_CSI2_DPHY,
> + };
> + unsigned long link_freq_bitmap;
> + struct fwnode_handle *ep;
> + int ret;
> +
> + ep = fwnode_graph_get_next_endpoint(dev_fwnode(os05e10->dev), NULL);
> + ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
> + fwnode_handle_put(ep);
> + if (ret)
> + return ret;
> +
> + ret = v4l2_link_freq_to_bitmap(os05e10->dev, bus_cfg.link_frequencies,
> + bus_cfg.nr_of_link_frequencies,
> + link_freq_menu_items,
> + ARRAY_SIZE(link_freq_menu_items),
> + &link_freq_bitmap);
> +
> + v4l2_fwnode_endpoint_free(&bus_cfg);
> +
> + return ret;
> +};
[Severity: Medium]
Should os05e10_parse_endpoint() verify that
bus_cfg.bus.mipi_csi2.num_data_lanes equals OS05E10_DATA_LANES?
The ovti,os05e10 devicetree binding allows both 2-lane and 4-lane CSI-2
configurations, while this driver hardcodes 4 lanes for os05e10_pixel_rate()
and os05e10_common_regs[]. Without checking num_data_lanes, probing on a
2-lane board succeeds silently with a mismatched lane configuration.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261123145445.66636-1-bhavin.sharma@siliconsignals.io?part=2
prev parent reply other threads:[~2026-11-23 15:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-23 14:54 [PATCH 0/2] media: i2c: Add os05e10 camera sensor driver Bhavin Sharma
2026-11-23 14:54 ` [PATCH 1/2] dt-bindings: media: i2c: Add os05e10 sensor Bhavin Sharma
2026-11-23 14:54 ` [PATCH 2/2] media: i2c: add os05e10 image sensor driver Bhavin Sharma
2026-11-23 15:09 ` sashiko-bot [this message]
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-229499@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bhavin.sharma@siliconsignals.io \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=robh@kernel.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