From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Kees Cook <kees@kernel.org>, Georgi Djakov <djakov@kernel.org>
Cc: linux-pm@vger.kernel.org,
Konrad Dybcio <konrad.dybcio@linaro.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH] interconnect: icc-clk: Add missed num_nodes initialization
Date: Tue, 16 Jul 2024 15:53:58 -0600 [thread overview]
Message-ID: <de26df66-67e8-4b88-b337-a50311bf2ea2@embeddedor.com> (raw)
In-Reply-To: <20240716214819.work.328-kees@kernel.org>
On 16/07/24 15:48, Kees Cook wrote:
> With the new __counted_by annotation, the "num_nodes" struct member must
> be set before accessing the "nodes" array. This initialization was done
> in other places where a new struct icc_onecell_data is allocated, but this
> case in icc_clk_register() was missed. Set "num_nodes" after allocation.
>
> Fixes: dd4904f3b924 ("interconnect: qcom: Annotate struct icc_onecell_data with __counted_by")
> Signed-off-by: Kees Cook <kees@kernel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Thanks
--
Gustavo
> ---
> Cc: Georgi Djakov <djakov@kernel.org>
> Cc: linux-pm@vger.kernel.org
> ---
> drivers/interconnect/icc-clk.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/interconnect/icc-clk.c b/drivers/interconnect/icc-clk.c
> index f788db15cd76..b956e4050f38 100644
> --- a/drivers/interconnect/icc-clk.c
> +++ b/drivers/interconnect/icc-clk.c
> @@ -87,6 +87,7 @@ struct icc_provider *icc_clk_register(struct device *dev,
> onecell = devm_kzalloc(dev, struct_size(onecell, nodes, 2 * num_clocks), GFP_KERNEL);
> if (!onecell)
> return ERR_PTR(-ENOMEM);
> + onecell->num_nodes = 2 * num_clocks;
>
> qp = devm_kzalloc(dev, struct_size(qp, clocks, num_clocks), GFP_KERNEL);
> if (!qp)
> @@ -133,8 +134,6 @@ struct icc_provider *icc_clk_register(struct device *dev,
> onecell->nodes[j++] = node;
> }
>
> - onecell->num_nodes = j;
> -
> ret = icc_provider_register(provider);
> if (ret)
> goto err;
prev parent reply other threads:[~2024-07-16 21:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 21:48 [PATCH] interconnect: icc-clk: Add missed num_nodes initialization Kees Cook
2024-07-16 21:53 ` Gustavo A. R. Silva [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=de26df66-67e8-4b88-b337-a50311bf2ea2@embeddedor.com \
--to=gustavo@embeddedor.com \
--cc=djakov@kernel.org \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@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