Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

clk: en7523: Initialize num before accessing hws in en7523_register_clocks()

With the new __counted_by annotation in clk_hw_onecell_data, the "num"
struct member must be set before accessing the "hws" array. Failing to
do so will trigger a runtime warning when enabling CONFIG_UBSAN_BOUNDS
and CONFIG_FORTIFY_SOURCE.

Fixes: f316cdff8d67 ("clk: Annotate struct clk_hw_onecell_data with __counted_by")
Signed-off-by: Haoyu Li <lihaoyu499@gmail.com>
Link: https://lore.kernel.org/r/20241203142915.345523-1-lihaoyu499@gmail.com
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Haoyu Li and committed by
Stephen Boyd
52fd1709 2eb75f86

+2 -2
+2 -2
drivers/clk/clk-en7523.c
··· 504 504 u32 rate; 505 505 int i; 506 506 507 + clk_data->num = EN7523_NUM_CLOCKS; 508 + 507 509 for (i = 0; i < ARRAY_SIZE(en7523_base_clks); i++) { 508 510 const struct en_clk_desc *desc = &en7523_base_clks[i]; 509 511 u32 reg = desc->div_reg ? desc->div_reg : desc->base_reg; ··· 527 525 528 526 hw = en7523_register_pcie_clk(dev, np_base); 529 527 clk_data->hws[EN7523_CLK_PCIE] = hw; 530 - 531 - clk_data->num = EN7523_NUM_CLOCKS; 532 528 } 533 529 534 530 static int en7523_clk_hw_init(struct platform_device *pdev,