[PATCH 0/2] lib: sbi_pmu: propagate hardware counter errors

Sebastian Alba Vives sebasjosue84 at gmail.com
Sat Oct 24 23:28:33 PDT 2026


Anup asked for these two as separate patches in the thread for
Pengpeng Hou's SKIP_MATCH class check:

  https://lore.kernel.org/r/20260827115718.50124-1-pengpeng@iscas.ac.cn

They go as a series rather than two independent patches because both
touch the same if block in sbi_pmu_ctr_cfg_match(), and the second
does not apply without the first.

Both are hardening of a latent defect rather than a fix for a
reachable one. Since 9f37e25f landed I could not find a route that
gets a bad counter index into either call site on current master;
details are in the note under patch 2. The Fixes tag points at the
commit that introduced the missing checks.

Built clean for rv64 and rv32, PLATFORM=generic, no new warnings.

Sebastian Alba Vives (2):
  lib: sbi_pmu: do not ignore pmu_ctr_start_hw() error in cfg_match
  lib: sbi_pmu: reject out-of-bounds counter index in pmu_ctr_write_hw()

 lib/sbi/sbi_pmu.c | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

-- 
2.43.0




More information about the opensbi mailing list