From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Georgi Djakov <djakov@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-pm@vger.kernel.org,
kernel-janitors@vger.kernel.org
Subject: Re: [PATCH v2] interconnect: qcom: rpm: allocate enough data in probe()
Date: Tue, 23 May 2023 12:29:36 +0200 [thread overview]
Message-ID: <87b5dda1-be2b-d123-e026-176d4c732b3f@linaro.org> (raw)
In-Reply-To: <e0fa275c-ae63-4342-9c9e-0ffaf6314da1@kili.mountain>
On 23.05.2023 12:27, Dan Carpenter wrote:
> This was not allocating enough bytes. There are two issue here.
> First, there was a typo where it was taking the size of the pointer
> instead of the size of the struct, "sizeof(qp->intf_clks)" vs
> "sizeof(*qp->intf_clks)". Second, it's an array of "cd_num" clocks so
> we need to allocate space for more than one element.
>
> Fixes: 2e2113c8a64f ("interconnect: qcom: rpm: Handle interface clocks")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>
Konrad
> v2: allocate enough space for the array
>
> drivers/interconnect/qcom/icc-rpm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c
> index f4627c4a1bdd..6acc7686ed38 100644
> --- a/drivers/interconnect/qcom/icc-rpm.c
> +++ b/drivers/interconnect/qcom/icc-rpm.c
> @@ -436,7 +436,7 @@ int qnoc_probe(struct platform_device *pdev)
> if (!qp)
> return -ENOMEM;
>
> - qp->intf_clks = devm_kzalloc(dev, sizeof(qp->intf_clks), GFP_KERNEL);
> + qp->intf_clks = devm_kcalloc(dev, cd_num, sizeof(*qp->intf_clks), GFP_KERNEL);
> if (!qp->intf_clks)
> return -ENOMEM;
>
prev parent reply other threads:[~2023-05-23 10:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 10:27 [PATCH v2] interconnect: qcom: rpm: allocate enough data in probe() Dan Carpenter
2023-05-23 10:29 ` Konrad Dybcio [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=87b5dda1-be2b-d123-e026-176d4c732b3f@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=dan.carpenter@linaro.org \
--cc=djakov@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
/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