Skip to content

[PW_SID:1158844] clk: tenstorrent: Assign .num before accessing .hws - #2599

Open
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1158844
Open

[PW_SID:1158844] clk: tenstorrent: Assign .num before accessing .hws#2599
linux-riscv-bot wants to merge 1 commit into
workflow__riscv__fixesfrom
pw1158844

Conversation

@linux-riscv-bot

Copy link
Copy Markdown

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

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>
@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 143.22 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1176.52 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1495.67 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.39 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.42 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.76 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 90.36 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
kdoc
Desc: Detects for kdoc errors
Duration: 0.82 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
module-param
Desc: Detect module_param changes
Duration: 0.37 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 3.70 seconds
Result: PASS

@linux-riscv-bot

Copy link
Copy Markdown
Author

Patch 1: "clk: tenstorrent: Assign .num before accessing .hws"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.56 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants