diff options
author | Georgi Djakov <djakov@kernel.org> | 2024-12-03 23:33:34 +0100 |
---|---|---|
committer | Georgi Djakov <djakov@kernel.org> | 2024-12-17 13:03:02 +0100 |
commit | 00a973e093e93690d433f1e1873ee52a6a6eca1f (patch) | |
tree | 3382aa9657224e8f7fdc287efd9c37f595df1922 /drivers/interconnect | |
parent | Linux 6.13-rc1 (diff) | |
download | linux-00a973e093e93690d433f1e1873ee52a6a6eca1f.tar.xz linux-00a973e093e93690d433f1e1873ee52a6a6eca1f.zip |
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: dd4904f3b924 ("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>
Diffstat (limited to 'drivers/interconnect')
-rw-r--r-- | drivers/interconnect/qcom/icc-rpm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/interconnect/qcom/icc-rpm.c b/drivers/interconnect/qcom/icc-rpm.c index a8ed435f696c..ea1042d38128 100644 --- a/drivers/interconnect/qcom/icc-rpm.c +++ b/drivers/interconnect/qcom/icc-rpm.c @@ -503,6 +503,7 @@ int qnoc_probe(struct platform_device *pdev) GFP_KERNEL); if (!data) return -ENOMEM; + data->num_nodes = num_nodes; qp->num_intf_clks = cd_num; for (i = 0; i < cd_num; i++) @@ -597,7 +598,6 @@ regmap_done: data->nodes[i] = node; } - data->num_nodes = num_nodes; clk_bulk_disable_unprepare(qp->num_intf_clks, qp->intf_clks); |