From: sashiko-bot@kernel.org
To: "Robert Bozik" <robertbozik@gmail.com>
Cc: media-ci@linuxtv.org, robh@kernel.org, conor+dt@kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/3] media: i2c: Add driver for OmniVision OV32C4
Date: Fri, 28 Aug 2026 13:35:37 +0000 [thread overview]
Message-ID: <20260828133537.C61EC1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260828132104.21473-3-robertbozik@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Potential NULL pointer dereference in ov32c4_set_format() when sd_state is NULL.
--
commit 1f7b42ee8c447c7e85f922c97bb8dbc3b6847261
Author: Robert Bozik <robertbozik@gmail.com>
media: i2c: Add driver for OmniVision OV32C4
This commit adds a Video4Linux2 I2C sensor driver for the OmniVision
OV32C4 camera. The driver supports basic streaming functionality,
analogue and digital gain, and flip controls.
> diff --git a/drivers/media/i2c/ov32c4.c b/drivers/media/i2c/ov32c4.c
> new file mode 100644
> index 0000000000000..8d11e1b00d73c
> --- /dev/null
> +++ b/drivers/media/i2c/ov32c4.c
[ ... ]
> +static int ov32c4_set_format(struct v4l2_subdev *sd,
> + struct v4l2_subdev_state *sd_state,
> + struct v4l2_subdev_format *fmt)
> +{
> + const struct ov32c4_mode *mode = &supported_modes[0];
> + struct ov32c4 *ov32c4 = to_ov32c4(sd);
> + s32 vblank_def, h_blank;
> +
> + ov32c4_update_pad_format(mode, &fmt->format);
> + *v4l2_subdev_state_get_format(sd_state, fmt->pad) = fmt->format;
[Severity: High]
Can this code cause a NULL pointer dereference?
If the driver is compiled without CONFIG_MEDIA_CONTROLLER, the V4L2 core
does not allocate a fallback active state. A legacy bridge driver invoking
v4l2_subdev_call(sd, pad, set_fmt, NULL, &fmt) can pass sd_state == NULL
to ov32c4_set_format().
Because the core check_format() guard permits state == NULL when
which == V4L2_SUBDEV_FORMAT_ACTIVE, this function will still execute.
When v4l2_subdev_state_get_format() is passed a NULL state, it returns NULL.
The subsequent structure assignment then unconditionally dereferences it,
which would lead to a kernel panic.
> +
> + if (fmt->which == V4L2_SUBDEV_FORMAT_TRY)
> + return 0;
> +
> + vblank_def = mode->vts_min - mode->height;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828132104.21473-1-robertbozik@gmail.com?part=2
next prev parent reply other threads:[~2026-08-28 13:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 13:21 [PATCH v2 0/3] media: Add OmniVision OV32C4 sensor driver Robert Bozik
2026-08-28 13:21 ` [PATCH v2 1/3] dt-bindings: media: i2c: Add OmniVision OV32C4 Robert Bozik
2026-08-28 16:23 ` Conor Dooley
2026-08-28 13:21 ` [PATCH v2 2/3] media: i2c: Add driver for " Robert Bozik
2026-08-28 13:35 ` sashiko-bot [this message]
2026-08-28 13:59 ` Robert Bozik
2026-08-28 13:21 ` [PATCH v2 3/3] media: ipu-bridge: Add " Robert Bozik
2026-08-28 15:23 ` Sakari Ailus
2026-08-28 15:34 ` Robert Bozik
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=20260828133537.C61EC1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=media-ci@linuxtv.org \
--cc=robertbozik@gmail.com \
--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 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.