From: Ulf Hansson <ulf.hansson@linaro.org>
To: Zhang Zekun <zhangzekun11@huawei.com>
Cc: andersson@kernel.org, konradybcio@kernel.org,
linux-pm@vger.kernel.org, dan.carpenter@linaro.org,
chenjun102@huawei.com
Subject: Re: [PATCH] pmdomain: qcom-cpr: Fix the return of uninitialized variable
Date: Wed, 2 Oct 2024 12:59:08 +0200 [thread overview]
Message-ID: <CAPDyKFogjPsZMDPQ3pBR-8WhkOMH0W76FX_sQY2ZKRGC5XMugw@mail.gmail.com> (raw)
In-Reply-To: <20240926134211.45394-1-zhangzekun11@huawei.com>
On Thu, 26 Sept 2024 at 15:56, Zhang Zekun <zhangzekun11@huawei.com> wrote:
>
> The of_property_read_u64() can fail and remain the variable uninitialized,
> which will then be returned. Initializing the variable "rate" to zero to
> fix this problem.
>
> Fixes: 181c8148556a ("pmdomain: qcom-cpr: Use scope based of_node_put() to simplify code.")
> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> Closes: https://lore.kernel.org/linux-pm/455a6a49-41d2-4a20-9a31-f57ee7a67920@huawei.com/T/#m0a62b501b453a6d6e94c52a428a66f65b5422c65
> Signed-off-by: Zhang Zekun <zhangzekun11@huawei.com>
Applied for fixes, thanks!
Kind regards
Uffe
> ---
> drivers/pmdomain/qcom/cpr.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/pmdomain/qcom/cpr.c b/drivers/pmdomain/qcom/cpr.c
> index e1fca65b80be..26a60a101e42 100644
> --- a/drivers/pmdomain/qcom/cpr.c
> +++ b/drivers/pmdomain/qcom/cpr.c
> @@ -1052,7 +1052,7 @@ static unsigned long cpr_get_opp_hz_for_req(struct dev_pm_opp *ref,
> of_parse_phandle(child_np, "required-opps", 0);
>
> if (child_req_np == ref_np) {
> - u64 rate;
> + u64 rate = 0;
>
> of_property_read_u64(child_np, "opp-hz", &rate);
> return (unsigned long) rate;
> --
> 2.17.1
>
prev parent reply other threads:[~2024-10-02 10:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-26 13:42 [PATCH] pmdomain: qcom-cpr: Fix the return of uninitialized variable Zhang Zekun
2024-10-02 10:59 ` Ulf Hansson [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=CAPDyKFogjPsZMDPQ3pBR-8WhkOMH0W76FX_sQY2ZKRGC5XMugw@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=andersson@kernel.org \
--cc=chenjun102@huawei.com \
--cc=dan.carpenter@linaro.org \
--cc=konradybcio@kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=zhangzekun11@huawei.com \
/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;
as well as URLs for NNTP newsgroup(s).