[PW_SID:1158844] clk: tenstorrent: Assign .num before accessing .hws - #2599
[PW_SID:1158844] clk: tenstorrent: Assign .num before accessing .hws#2599linux-riscv-bot wants to merge 1 commit into
Conversation
Commit f316cdf ("clk: Annotate struct clk_hw_onecell_data with __counted_by") annotated the hws member of 'struct clk_hw_onecell_data' with __counted_by, which informs the bounds sanitizer (UBSAN_BOUNDS) about the number of elements in .hws[], so that it can warn when .hws[] is accessed out of bounds. As noted in that change, the __counted_by member must be initialized with the number of elements before the first array access happens, otherwise there will be a warning from each access prior to the initialization because the number of elements is zero. This occurs in atlantis_prcm_clocks_register() due to .num being assigned only after every clock has been stored in .hws[]. With CONFIG_UBSAN_BOUNDS and a compiler that implements __counted_by (GCC 15.1+ or Clang 20.1+), this triggers an array-index-out-of-bounds report during probe, and with CONFIG_UBSAN_TRAP the first store traps so the clock provider never registers. Move the .num initialization to right after the allocation. Cc: stable@vger.kernel.org Fixes: 23c8ebc ("clk: tenstorrent: Add Atlantis clock controller driver") Assisted-by: LLM Signed-off-by: Aamir Ahmed <elb12345@hotmail.co.uk> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
|
Patch 1: "clk: tenstorrent: Assign .num before accessing .hws" |
PR for series 1158844 applied to workflow__riscv__fixes
Name: clk: tenstorrent: Assign .num before accessing .hws
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1158844
Version: 1