Skip to content

Commit c801ed8

Browse files
keesGeorgi Djakov
authored andcommitted
interconnect: icc-clk: Add missed num_nodes initialization
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: dd4904f ("interconnect: qcom: Annotate struct icc_onecell_data with __counted_by") Signed-off-by: Kees Cook <[email protected]> Reviewed-by: Gustavo A. R. Silva <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Georgi Djakov <[email protected]>
1 parent 7d59b1f commit c801ed8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/interconnect/icc-clk.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ struct icc_provider *icc_clk_register(struct device *dev,
8787
onecell = devm_kzalloc(dev, struct_size(onecell, nodes, 2 * num_clocks), GFP_KERNEL);
8888
if (!onecell)
8989
return ERR_PTR(-ENOMEM);
90+
onecell->num_nodes = 2 * num_clocks;
9091

9192
qp = devm_kzalloc(dev, struct_size(qp, clocks, num_clocks), GFP_KERNEL);
9293
if (!qp)
@@ -133,8 +134,6 @@ struct icc_provider *icc_clk_register(struct device *dev,
133134
onecell->nodes[j++] = node;
134135
}
135136

136-
onecell->num_nodes = j;
137-
138137
ret = icc_provider_register(provider);
139138
if (ret)
140139
goto err;

0 commit comments

Comments
 (0)