dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Muzaffer Kadir" <muzafferkadir@mainlining.org>
Cc: dmitry.torokhov@gmail.com, devicetree@vger.kernel.org,
	lee@kernel.org, dri-devel@lists.freedesktop.org,
	linux-clk@vger.kernel.org, conor+dt@kernel.org,
	mfd@lists.linux.dev, linux-input@vger.kernel.org,
	robh@kernel.org
Subject: Re: [PATCH RFC 19/20] dt-bindings: input: touchscreen: goodix: Add binding for GT970
Date: Sat, 12 Sep 2026 08:50:37 +0000	[thread overview]
Message-ID: <20260912085038.19E281F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260912-msm8952-initial-support-v1-19-0e742578b524@mainlining.org>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

Pre-existing issues:
- [High] Heap out-of-bounds write in init_8952 due to hardcoded sensor initialization without validating num_sensors.
- [High] Missing upper bounds check on num_sensors causes a NULL pointer dereference in tsens_threshold_violated.
--

commit e2c03bc036014af0112367e60c92c407413054c8
Author: Muzaffer Kadir <muzafferkadir@mainlining.org>

dt-bindings: input: touchscreen: goodix: Add binding for GT970

This commit adds a new compatible string for the GT970 touchscreen controller
to the Goodix binding schema. It documents GT970 as falling back to the GT911
compatible string since it works with the GT911 driver.

> diff --git a/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> index a26a54d63a1c0..4be2c137abd7c 100644
> --- a/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml
> +++ b/Documentation/devicetree/bindings/input/touchscreen/goodix.yaml

[ ... ]

[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential heap
out-of-bounds write in init_8952() due to hardcoded sensor initialization
without validating num_sensors.

If a device tree specifies a #qcom,sensors value less than 11 for a
platform using init_8952() (like msm8952), tsens_probe() allocates a priv
structure with a smaller flexible array for sensors.

drivers/thermal/qcom/tsens-v1.c:init_8952() {
    ...
	priv->sensor[10].p1_calib_offset = -3;
	priv->sensor[10].p2_calib_offset = -2;
    ...
}

Does this code overflow the priv->sensor[] array? Because init_8952()
unconditionally assigns values up to priv->sensor[10], this can overwrite
memory past the allocation if a malformed device tree property is provided
by the bootloader.

[Severity: High]
This is a pre-existing issue, but there appears to be a missing upper bounds
check on num_sensors that causes a NULL pointer dereference.

In tsens_probe(), the unbounded value is introduced here:

drivers/thermal/qcom/tsens.c:tsens_probe() {
    ...
	if (np)
		of_property_read_u32(np, "#qcom,sensors", &num_sensors);
    ...
}

If #qcom,sensors specifies a value greater than priv->feat->max_sensors,
tsens_probe() sets priv->num_sensors to this larger value. init_common()
allocates regmap_field entries in priv->rf only up to max_sensors.

Later, tsens_irq_thread() iterates up to priv->num_sensors and calls
tsens_threshold_violated(), which dereferences the uninitialized regmap
field:

drivers/thermal/qcom/tsens.c:tsens_threshold_violated() {
    ...
	ret = regmap_field_read(priv->rf[UPPER_STATUS_0 + hw_id], &d->up_viol);
    ...
}

Does this cause a NULL pointer dereference when accessing priv->rf[]? For
sensors beyond max_sensors, the regmap_field pointer is NULL, causing
regmap_field_read() to crash if a malformed device tree property is
present. Could we validate num_sensors against max_sensors during probe?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260912-msm8952-initial-support-v1-0-0e742578b524@mainlining.org?part=19

  reply	other threads:[~2026-09-12  8:50 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-12  8:39 [PATCH RFC 00/20] Add Initial Support For MSM8952, Add General Mobile Shamrock Muzaffer Kadir via B4 Relay
2026-09-12  8:39 ` [PATCH RFC 01/20] dt-bindings: clock: qcom: Add MSM8952 global clock controller Muzaffer Kadir via B4 Relay
2026-09-12  8:45   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 02/20] clk: qcom: Add global clock controller driver for MSM8952 Muzaffer Kadir via B4 Relay
2026-09-12  8:54   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 03/20] dt-bindings: nvmem: Add compatible " Muzaffer Kadir via B4 Relay
2026-09-12  8:42   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 04/20] dt-bindings: power: rpmpd: Add MSM8952 power domains Muzaffer Kadir via B4 Relay
2026-09-12  8:42   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 05/20] dt-bindings: mmc: sdhci-msm: Add MSM8952 compatible Muzaffer Kadir via B4 Relay
2026-09-12  8:43   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 06/20] dt-bindings: vendor-prefixes: Add General Mobile Muzaffer Kadir via B4 Relay
2026-09-12  8:41   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 07/20] dt-bindings: arm: qcom: Document MSM8952 SoC binding Muzaffer Kadir via B4 Relay
2026-09-12  8:48   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 08/20] dt-bindings: iommu: qcom,iommu: Add MSM8952 IOMMU to SMMUv2 compatibles Muzaffer Kadir via B4 Relay
2026-09-12  8:42   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 09/20] dt-bindings: mfd: qcom,tcsr: Add compatible for MSM8952 Muzaffer Kadir via B4 Relay
2026-09-12  8:42   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 10/20] dt-bindings: display/msm: qcom, mdp5: Add MSM8952 compatible Muzaffer Kadir via B4 Relay
2026-09-12  8:47   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 11/20] dt-bindings: firmware: qcom,scm: Document MSM8952 SCM Muzaffer Kadir via B4 Relay
2026-09-12  8:44   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 12/20] dt-bindings: clock: qcom,rpmcc: Add MSM8952 compatible Muzaffer Kadir via B4 Relay
2026-09-12  8:46   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 13/20] clk: qcom: smd-rpm: Add clocks for MSM8952 Muzaffer Kadir via B4 Relay
2026-09-12  8:46   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 14/20] drm: msm: mdp5: Add MDP5 configuration " Muzaffer Kadir via B4 Relay
2026-09-12  9:19   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 15/20] soc: qcom: ubwc: Add UBWC config " Muzaffer Kadir via B4 Relay
2026-09-12  8:43   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 16/20] dt-bindings: thermal: tsens: Add MSM8952 Muzaffer Kadir via B4 Relay
2026-09-12  8:51   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 17/20] thermal: qcom: tsens: Add support for MSM8952 tsens Muzaffer Kadir via B4 Relay
2026-09-12  8:51   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 18/20] arm64: dts: qcom: Add initial support for MSM8952 Muzaffer Kadir via B4 Relay
2026-09-12  8:56   ` sashiko-bot
2026-09-12  8:39 ` [PATCH RFC 19/20] dt-bindings: input: touchscreen: goodix: Add binding for GT970 Muzaffer Kadir via B4 Relay
2026-09-12  8:50   ` sashiko-bot [this message]
2026-09-12  8:39 ` [PATCH RFC 20/20] arm64: dts: qcom: generalmobile-shamrock: new device Muzaffer Kadir via B4 Relay
2026-09-12  8:58   ` sashiko-bot
2026-09-12 15:47   ` David Heidelberg
2026-09-12 17:42     ` Muzaffer Kadir

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=20260912085038.19E281F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=lee@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=mfd@lists.linux.dev \
    --cc=muzafferkadir@mainlining.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