On Wed, Sep 23, 2026 at 06:01:14AM +0000, Bill Wendling wrote: > Annotate the 'qm_cap_table' and 'dev_cap_table' pointer fields in > 'struct hisi_qm_cap_tables' with the '__counted_by_ptr' attribute. > This improves bounds checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE, allowing KASAN and compiler diagnostics to > detect out-of-bounds accesses. > > The 'qm_cap_table' pointer is associated with 'qm_cap_size' which > specifies its element count. Similarly, 'dev_cap_table' is associated > with 'dev_cap_size'. > > To ensure safety under compiler instrumentation, the assignments in the > initialization paths have been updated to set the 'size'/'count' fields > prior to setting the pointer fields. This prevents any transient state > where the pointer is valid but the count is 0 (or uninitialized), > ensuring that subsequent accesses to these tables do not trigger > false-positive bounds check panics. > > Cc: [email protected] > Assisted-by: LLM > Signed-off-by: Bill Wendling <[email protected]> > --- > drivers/crypto/hisilicon/hpre/hpre_main.c | 2 +- > drivers/crypto/hisilicon/qm.c | 2 +- > drivers/crypto/hisilicon/sec2/sec_main.c | 2 +- > drivers/crypto/hisilicon/zip/zip_main.c | 2 +- > include/linux/hisi_acc_qm.h | 4 ++-- > 5 files changed, 6 insertions(+), 6 deletions(-)
Patch applied. Thanks. -- Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

