From: Max Zhen <max.zhen@amd.com>
To: Lizhi Hou <lizhi.hou@amd.com>, <ogabbay@kernel.org>,
<quic_jhugo@quicinc.com>, <dri-devel@lists.freedesktop.org>,
<mario.limonciello@amd.com>, <karol.wachowski@linux.intel.com>
Cc: <linux-kernel@vger.kernel.org>, <sonal.santan@amd.com>
Subject: Re: [PATCH V1] accel/amdxdna: Remove __counted_by from struct amdxdna_cmd_chain
Date: Fri, 21 Aug 2026 10:50:44 -0700 [thread overview]
Message-ID: <7ce13e6d-0da6-4d6c-a05b-3ad5e67499f4@amd.com> (raw)
In-Reply-To: <20260821033543.1839719-1-lizhi.hou@amd.com>
On 8/20/2026 Thu 20:35, Lizhi Hou wrote:
> struct amdxdna_cmd_chain contains a flexible array annotated with
> __counted_by(command_count). Since the structure is stored in shared
> AMDXDNA_BO_SHARE memory, userspace can modify command_count concurrently.
> If command_count is changed to zero, the bounds check generated from
> __counted_by may fail and trigger a kernel panic.
>
> Remove __counted_by to avoid relying on the userspace-controlled
> command_count for the flexible array bounds check.
>
> Fixes: aac243092b70 ("accel/amdxdna: Add command execution")
> Signed-off-by: Lizhi Hou <lizhi.hou@amd.com>
Reviewed-by: Max Zhen <max.zhen@amd.com>
> ---
> drivers/accel/amdxdna/amdxdna_ctx.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/accel/amdxdna/amdxdna_ctx.h b/drivers/accel/amdxdna/amdxdna_ctx.h
> index e6155f4b5db0..010538cb05a3 100644
> --- a/drivers/accel/amdxdna/amdxdna_ctx.h
> +++ b/drivers/accel/amdxdna/amdxdna_ctx.h
> @@ -56,7 +56,7 @@ struct amdxdna_cmd_chain {
> u32 submit_index;
> u32 error_index;
> u32 reserved[3];
> - u64 data[] __counted_by(command_count);
> + u64 data[];
> };
>
> /*
next prev parent reply other threads:[~2026-08-21 17:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-21 3:35 Lizhi Hou
2026-08-21 17:50 ` Max Zhen [this message]
2026-08-24 16:39 ` Lizhi Hou
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=7ce13e6d-0da6-4d6c-a05b-3ad5e67499f4@amd.com \
--to=max.zhen@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=karol.wachowski@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizhi.hou@amd.com \
--cc=mario.limonciello@amd.com \
--cc=ogabbay@kernel.org \
--cc=quic_jhugo@quicinc.com \
--cc=sonal.santan@amd.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®