[PATCH 1/2] drm/amdgpu/pptable: Fix __counted_by attribute

Deucher, Alexander Alexander.Deucher at amd.com
Fri Jun 14 17:27:30 UTC 2024


[Public]

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Mario
> Limonciello
> Sent: Friday, June 14, 2024 1:06 PM
> To: amd-gfx at lists.freedesktop.org
> Cc: Limonciello, Mario <Mario.Limonciello at amd.com>; Tasos Sahanidis
> <tasos at tasossah.com>
> Subject: [PATCH 1/2] drm/amdgpu/pptable: Fix __counted_by attribute
>
> The attribute is not helpful if commented out.

It's commented out on purpose because it breaks clang 19.  See:
https://lists.freedesktop.org/archives/amd-gfx/2024-May/109223.html

Alex

>
> Cc: Tasos Sahanidis <tasos at tasossah.com>
> Fixes: c6c4dd540125 ("drm/amdgpu/pptable: Fix UBSAN array-index-out-of-
> bounds")
> Signed-off-by: Mario Limonciello <mario.limonciello at amd.com>
> ---
>  drivers/gpu/drm/amd/include/pptable.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/include/pptable.h
> b/drivers/gpu/drm/amd/include/pptable.h
> index f83ace2d7ec3..984770d0eb4c 100644
> --- a/drivers/gpu/drm/amd/include/pptable.h
> +++ b/drivers/gpu/drm/amd/include/pptable.h
> @@ -480,7 +480,7 @@ typedef struct _StateArray{
>       //how many states we have
>       UCHAR ucNumEntries;
>
> -     ATOM_PPLIB_STATE_V2 states[] /* __counted_by(ucNumEntries) */;
> +     ATOM_PPLIB_STATE_V2 states[] __counted_by(ucNumEntries);
>  }StateArray;
>
>
> --
> 2.43.0



More information about the amd-gfx mailing list