mbox series

[0/2] clk: bcm: Move a couple of __counted_by initializations

Message ID 20240425-cbl-bcm-assign-counted-by-val-before-access-v1-0-e2db3b82d5ef@kernel.org (mailing list archive)
Headers show
Series clk: bcm: Move a couple of __counted_by initializations | expand

Message

Nathan Chancellor April 25, 2024, 4:55 p.m. UTC
Hi all,

This series addresses two UBSAN warnings I see on my Raspberry Pi 4 with
recent releases of clang that support __counted_by by moving the
initializations of the element count member before any accesses of the
flexible array member.

I marked these for stable because more distributions are enabling the
bounds sanitizer [1][2], so the warnings will show up when the kernel is
built with a compiler that supports __counted_by, so it seems worth
fixing this for future users.

[1]: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1914685
[2]: https://src.fedoraproject.org/rpms/kernel/c/79a2207963b8fea452acfc5dea13ed54bd36c7e1

---
Nathan Chancellor (2):
      clk: bcm: dvp: Assign ->num before accessing ->hws
      clk: bcm: rpi: Assign ->num before accessing ->hws

 drivers/clk/bcm/clk-bcm2711-dvp.c | 3 ++-
 drivers/clk/bcm/clk-raspberrypi.c | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
---
base-commit: ed30a4a51bb196781c8058073ea720133a65596f
change-id: 20240424-cbl-bcm-assign-counted-by-val-before-access-cf19d630f2b4

Best regards,