All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Qiang Yu" <qiang.yu@oss.qualcomm.com>
Cc: robh@kernel.org, devicetree@vger.kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v8 3/7] clk: qcom: Add generic clkref_en support
Date: Wed, 08 Jul 2026 10:27:28 +0000	[thread overview]
Message-ID: <20260708102729.10AF91F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260708-tcsr_qref_0708-v8-3-62c42b5fa269@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Uninitialized stack memory read in qcom_clk_ref_provider_get due to missing args_count check.
--

--- Patch [3]: [PATCH v8 3/7] clk: qcom: Add generic clkref_en support ---
commit 5fbeeca574eafbc5d86afc2e9ee00af52b02a04f
Author: Qiang Yu <qiang.yu@oss.qualcomm.com>

clk: qcom: Add generic clkref_en support

This commit adds generic support for clkref_en clocks in Qualcomm platforms.
It introduces a dedicated clk_ref clock type with custom operations that
manage both the enable bit and associated regulators, and provides a common
probe and registration API.

> diff --git a/drivers/clk/qcom/clk-ref.c b/drivers/clk/qcom/clk-ref.c
> new file mode 100644
> index 0000000000000..3efdf6749770d
> --- /dev/null
> +++ b/drivers/clk/qcom/clk-ref.c

[ ... ]

> +static struct clk_hw *qcom_clk_ref_provider_get(struct of_phandle_args *clkspec, void *data)
> +{
> +	struct qcom_clk_ref_provider *provider = data;
> +	unsigned int idx = clkspec->args[0];

[Severity: Medium]
Could this read uninitialized stack memory if a device tree node is
malformed?

If a consumer requests a clock but the provider's device tree node
incorrectly specifies #clock-cells = <0>, the device tree parsing logic
will set args_count to 0 and leave the args array uninitialized. 

Would it be safer to verify clkspec->args_count >= 1 before reading
clkspec->args[0]?

> +
> +	if (idx >= provider->num_refs)
> +		return ERR_PTR(-EINVAL);
> +
> +	if (!provider->refs[idx].regmap)
> +		return ERR_PTR(-ENOENT);
> +
> +	return &provider->refs[idx].hw;
> +}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260708-tcsr_qref_0708-v8-0-62c42b5fa269@oss.qualcomm.com?part=3

  reply	other threads:[~2026-07-08 10:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-08 10:02 [PATCH v8 0/7] clk: qcom: Add common clkref support and migrate Glymur and Mahua Qiang Yu
2026-07-08 10:02 ` [PATCH v8 1/7] dt-bindings: clock: qcom: Move glymur TCSR to own binding Qiang Yu
2026-07-08 10:09   ` sashiko-bot
2026-07-09  7:48   ` Krzysztof Kozlowski
2026-07-08 10:02 ` [PATCH v8 2/7] dt-bindings: clock: qcom,glymur-tcsr: Add mahua support Qiang Yu
2026-07-08 10:15   ` sashiko-bot
2026-07-09  7:49   ` Krzysztof Kozlowski
2026-07-08 10:02 ` [PATCH v8 3/7] clk: qcom: Add generic clkref_en support Qiang Yu
2026-07-08 10:27   ` sashiko-bot [this message]
2026-07-08 10:02 ` [PATCH v8 4/7] clk: qcom: tcsrcc-glymur: Add regulator supplies and migrate to clk_ref helper Qiang Yu
2026-07-08 10:02 ` [PATCH v8 5/7] clk: qcom: tcsrcc-glymur: Add Mahua QREF regulator support Qiang Yu
2026-07-08 10:39   ` sashiko-bot
2026-07-09 11:24   ` Konrad Dybcio
2026-07-08 10:02 ` [PATCH v8 6/7] arm64: dts: qcom: glymur: Add QREF regulator supplies to TCSR Qiang Yu
2026-07-08 10:02 ` [PATCH v8 7/7] arm64: dts: qcom: mahua: " Qiang Yu

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=20260708102729.10AF91F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=qiang.yu@oss.qualcomm.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.