All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Armandas Kvietkus" <armandas.kvietkus@proton.me>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org,
	media-ci@linuxtv.org
Subject: Re: [PATCH v2 2/2] media: i2c: Add Samsung S5K3T2 image sensor driver
Date: Wed, 23 Sep 2026 15:31:33 +0000	[thread overview]
Message-ID: <20260923153133.8D0451F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260923-upstream-s5k3t2-v2-2-04ffda3350c1@proton.me>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] media: i2c: s5k3t2: V4L2 controls are silently ignored when CONFIG_PM=n
- [Medium] media: i2c: s5k3t2: unchecked dereference of v4l2_subdev_state_get_format()
--

commit 0ff25daea454ea586f399f585c1432a8ce3f431a
Author: Armandas Kvietkus <armandas.kvietkus@proton.me>

media: i2c: Add Samsung S5K3T2 image sensor driver

This commit adds a V4L2 driver for the Samsung S5K3T2 20 Mpixel CMOS
image sensor, supporting three modes up to 5184x3880.

> diff --git a/drivers/media/i2c/s5k3t2.c b/drivers/media/i2c/s5k3t2.c
> new file mode 100644
> index 0000000000000..de24a6b9dacae
> --- /dev/null
> +++ b/drivers/media/i2c/s5k3t2.c
[ ... ]
> +static int s5k3t2_set_ctrl(struct v4l2_ctrl *ctrl)
> +{
> +	struct s5k3t2 *s5k3t2 = container_of(ctrl->handler, struct s5k3t2,
> +					     ctrl_handler);
[ ... ]
> +	}
> +
> +	if (pm_runtime_get_if_active(s5k3t2->dev) <= 0)
> +		return 0;

[Severity: High]
When the kernel is built with CONFIG_PM disabled, pm_runtime_get_if_active()
returns -EINVAL. Could this condition evaluate to true for that -EINVAL
return, incorrectly treating it as a suspended state?

If so, this would cause the function to return 0 without writing any values
to the hardware registers, silently ignoring all V4L2 control updates like
exposure and gain permanently.

> +
> +	switch (ctrl->id) {
> +	case V4L2_CID_ANALOGUE_GAIN:
[ ... ]
> +static int s5k3t2_set_pad_format(struct v4l2_subdev *sd,
> +				 struct v4l2_subdev_state *state,
> +				 struct v4l2_subdev_format *fmt)
> +{
[ ... ]
> +	if (s5k3t2->sd.ctrl_handler->error)
> +		return s5k3t2->sd.ctrl_handler->error;
> +
> +set_format:
> +	*v4l2_subdev_state_get_format(state, 0) = fmt->format;

[Severity: Medium]
Can v4l2_subdev_state_get_format() return NULL here and lead to an unchecked
pointer dereference?

While the check_format() guard normally executes for standard ioctls,
s5k3t2_init_state() acts as a direct caller that bypasses the check_state()
core validation wrapper. Additionally, this performs a mismatched lookup by
hardcoding pad 0 instead of matching the fmt->pad parameter.

> +
> +	return 0;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260923-upstream-s5k3t2-v2-0-04ffda3350c1@proton.me?part=2

      reply	other threads:[~2026-09-23 15:31 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23 15:18 [PATCH v2 0/2] media: i2c: Samsung S5K3T2 image sensor Armandas Kvietkus
2026-09-23 15:18 ` Armandas Kvietkus via B4 Relay
2026-09-23 15:18 ` [PATCH v2 1/2] dt-bindings: media: i2c: Add " Armandas Kvietkus
2026-09-23 15:18   ` Armandas Kvietkus via B4 Relay
2026-09-23 15:23   ` sashiko-bot
2026-09-23 15:18 ` [PATCH v2 2/2] media: i2c: Add Samsung S5K3T2 image sensor driver Armandas Kvietkus
2026-09-23 15:18   ` Armandas Kvietkus via B4 Relay
2026-09-23 15:31   ` 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=20260923153133.8D0451F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=armandas.kvietkus@proton.me \
    --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 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.