[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <de26df66-67e8-4b88-b337-a50311bf2ea2@embeddedor.com>
Date: Tue, 16 Jul 2024 15:53:58 -0600
From: "Gustavo A. R. Silva" <gustavo@...eddedor.com>
To: Kees Cook <kees@...nel.org>, Georgi Djakov <djakov@...nel.org>
Cc: linux-pm@...r.kernel.org, Konrad Dybcio <konrad.dybcio@...aro.org>,
"Gustavo A. R. Silva" <gustavoars@...nel.org>, linux-kernel@...r.kernel.org,
linux-hardening@...r.kernel.org
Subject: Re: [PATCH] interconnect: icc-clk: Add missed num_nodes
initialization
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@...nel.org>
Reviewed-by: Gustavo A. R. Silva <gustavoars@...nel.org>
Thanks
--
Gustavo
> ---
> Cc: Georgi Djakov <djakov@...nel.org>
> Cc: linux-pm@...r.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;
Powered by blists - more mailing lists