Re: [PATCH] crypto: hisilicon/qm - add __counted_by_ptr to dfx_diff_registers
From: Herbert Xu
Date: Fri Oct 02 2026 - 06:17:35 EST
Bill Wendling <morbo@xxxxxxxxxx> wrote:
> Annotate the pointer field 'regs' in 'struct dfx_diff_registers' with
> the '__counted_by_ptr' attribute, referencing the 'reg_len' member
> which holds the element count of the allocated memory.
>
> In 'drivers/crypto/hisilicon/debugfs.c', the 'dfx_regs_init' function
> allocates the 'diff_regs' array and initializes each element's 'regs'
> pointer after setting its 'reg_len'.
>
> Since 'reg_len' is set before 'regs' is assigned, the compiler's bounds
> sanitizer can correctly associate the pointer with its allocated size.
>
> Cc: codemender-patching+linux@xxxxxxxxxx
> Assisted-by: LLM
> Signed-off-by: Bill Wendling <morbo@xxxxxxxxxx>
> ---
> include/linux/hisi_acc_qm.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt