Skip to content

Commit 00a973e

Browse files
author
Georgi Djakov
committed
interconnect: qcom: icc-rpm: Set the count member before accessing the flex array
The following UBSAN error is reported during boot on the db410c board on a clang-19 build: Internal error: UBSAN: array index out of bounds: 00000000f2005512 [#1] PREEMPT SMP ... pc : qnoc_probe+0x5f8/0x5fc ... The cause of the error is that the counter member was not set before accessing the annotated flexible array member, but after that. Fix this by initializing it earlier. Reported-by: Linux Kernel Functional Testing <lkft@linaro.org> Closes: https://lore.kernel.org/r/CA+G9fYs+2mBz1y2dAzxkj9-oiBJ2Acm1Sf1h2YQ3VmBqj_VX2g@mail.gmail.com Fixes: dd4904f ("interconnect: qcom: Annotate struct icc_onecell_data with __counted_by") Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20241203223334.233404-1-djakov@kernel.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
1 parent 40384c8 commit 00a973e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/interconnect/qcom/icc-rpm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ int qnoc_probe(struct platform_device *pdev)
503503
GFP_KERNEL);
504504
if (!data)
505505
return -ENOMEM;
506+
data->num_nodes = num_nodes;
506507

507508
qp->num_intf_clks = cd_num;
508509
for (i = 0; i < cd_num; i++)
@@ -597,7 +598,6 @@ int qnoc_probe(struct platform_device *pdev)
597598

598599
data->nodes[i] = node;
599600
}
600-
data->num_nodes = num_nodes;
601601

602602
clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks);
603603

0 commit comments

Comments
 (0)