Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Esteban Urrutia" <esteuwu@proton.me>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/2] usb: typec: ucsi: ucsi_glink: Add compatible string for SM8475
Date: Fri, 31 Jul 2026 05:17:03 +0000	[thread overview]
Message-ID: <20260731051704.5AF041F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260731-sm8475-pmic-glink-v2-2-28c04928ef22@proton.me>

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

Pre-existing issues:
- [High] The format specifier %pOFn is incorrectly used with a struct fwnode_handle pointer.
--

--- Patch [2]: [PATCH v2 2/2] usb: typec: ucsi: ucsi_glink: Add compatible string for SM8475 ---
commit d37a66c9dfca5e74cbcec6a0c03a891ac3e2d3bd
Author: Esteban Urrutia <esteuwu@proton.me>

usb: typec: ucsi: ucsi_glink: Add compatible string for SM8475

Add compatible string for the PMIC GLINK service running on the coprocessor
found in the SM8475 SoC.

> diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c
> index 12e07b9fe6228..78a0ea349ed41 100644
> --- a/drivers/usb/typec/ucsi/ucsi_glink.c
> +++ b/drivers/usb/typec/ucsi/ucsi_glink.c
> @@ -381,6 +381,7 @@ static const struct of_device_id pmic_glink_ucsi_of_quirks[] = {
>  	{ .compatible = "qcom,sc8280xp-pmic-glink", .data = &quirk_sc8280xp, },
>  	{ .compatible = "qcom,sm8350-pmic-glink", .data = &quirk_sc8180x, },
>  	{ .compatible = "qcom,sm8450-pmic-glink", .data = &quirk_sm8450, },
> +	{ .compatible = "qcom,sm8475-pmic-glink", .data = &quirk_sm8450, },
>  	{ .compatible = "qcom,sm8550-pmic-glink", .data = &quirk_sm8450, },
>  	{ .compatible = "qcom,x1e80100-pmic-glink", .data = &quirk_x1e80100, },
>  	{}

[Severity: High]
This is a pre-existing issue, but does pmic_glink_ucsi_probe() pass the
wrong pointer type to dev_err() when handling a missing property?

drivers/usb/typec/ucsi/ucsi_glink.c:pmic_glink_ucsi_probe() {
    ...
	device_for_each_child_node_scoped(dev, fwnode) {
		struct gpio_desc *desc;
		u32 port;

		ret = fwnode_property_read_u32(fwnode, "reg", &port);
		if (ret < 0) {
			dev_err(dev, "missing reg property of %pOFn\n", fwnode);
			return ret;
		}
    ...
}

The %pOFn format specifier expects a struct device_node pointer, but it is
being passed a struct fwnode_handle pointer here.

When vsnprintf processes %pOFn, it will cast the pointer to struct device_node
and read the name or full_name fields at offsets that do not match struct
fwnode_handle.

Can this exceed the size of the structure and result in reading unrelated kernel
memory, potentially causing a kernel panic due to an invalid memory access if a
child node is missing the reg property?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260731-sm8475-pmic-glink-v2-0-28c04928ef22@proton.me?part=2

  reply	other threads:[~2026-07-31  5:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-31  5:00 [PATCH v2 0/2] Support for pmic-glink in SM8475 Esteban Urrutia via B4 Relay
2026-07-31  5:00 ` [PATCH v2 1/2] dt-bindings: soc: qcom: qcom,pmic-glink: Add compatible string for SM8475 Esteban Urrutia via B4 Relay
2026-07-31  5:10   ` sashiko-bot
2026-07-31  5:00 ` [PATCH v2 2/2] usb: typec: ucsi: ucsi_glink: " Esteban Urrutia via B4 Relay
2026-07-31  5:17   ` sashiko-bot [this message]
2026-07-31  5:40   ` Esteban Urrutia

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=20260731051704.5AF041F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=esteuwu@proton.me \
    --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