mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
To: Bill Wendling <morbo@google.com>,
	Weili Qian <qianweili@huawei.com>,
	Zhou Wang <wangzhou1@hisilicon.com>
Cc: Kees Cook <kees@kernel.org>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org,
	codemender-patching+linux@google.com
Subject: Re: [PATCH] crypto: hisilicon/qm - add __counted_by_ptr to dfx_diff_registers
Date: Wed, 23 Sep 2026 15:12:51 +0900	[thread overview]
Message-ID: <b2bc7fc9-baf3-4717-a012-cda73a9fe977@embeddedor.com> (raw)
In-Reply-To: <20260923061027.2650324-1-morbo@google.com>



On 9/23/26 15:10, Bill Wendling 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@google.com
> Assisted-by: LLM
> Signed-off-by: Bill Wendling <morbo@google.com>

Reviewed-by: Gustavo A. R. Silva <gustavoars@kernel.org>

Thanks
-Gustavo

> ---
>   include/linux/hisi_acc_qm.h | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/hisi_acc_qm.h b/include/linux/hisi_acc_qm.h
> index 8dc49fa2123b..f2885d60b468 100644
> --- a/include/linux/hisi_acc_qm.h
> +++ b/include/linux/hisi_acc_qm.h
> @@ -196,7 +196,7 @@ struct qm_dev_dfx {
>   };
>   
>   struct dfx_diff_registers {
> -	u32 *regs;
> +	u32 *regs __counted_by_ptr(reg_len);
>   	u32 reg_offset;
>   	u32 reg_len;
>   };


      reply	other threads:[~2026-09-23  6:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-23  6:10 Bill Wendling
2026-09-23  6:12 ` Gustavo A. R. Silva [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2bc7fc9-baf3-4717-a012-cda73a9fe977@embeddedor.com \
    --to=gustavo@embeddedor.com \
    --cc=codemender-patching+linux@google.com \
    --cc=gustavoars@kernel.org \
    --cc=kees@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=morbo@google.com \
    --cc=qianweili@huawei.com \
    --cc=wangzhou1@hisilicon.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®