* [PATCH] drm/amdgpu: Fix incorrect max handle limit in userq wait ioctl
@ 2026-02-25 7:20 Srinivasan Shanmugam
2026-02-25 8:01 ` Christian König
0 siblings, 1 reply; 2+ messages in thread
From: Srinivasan Shanmugam @ 2026-02-25 7:20 UTC (permalink / raw)
To: Christian König, Alex Deucher; +Cc: amd-gfx, Srinivasan Shanmugam
Clang reports that a comparison in amdgpu_userq_wait_ioctl()
is always false.
The field num_syncobj_timeline_handles is defined as __u16.
A __u16 value can only go up to 65535.
But AMDGPU_USERQ_MAX_HANDLES was defined as 65536.
So the check comparing the field with this limit could
never be true.
Change the limit to U16_MAX (65535) to match the field type.
Fixes the below:
amdgpu_userq_fence.c:642:46: warning: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
wait_info->num_syncobj_timeline_handles > AMDGPU_USERQ_MAX_HANDLES ||
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
index 136071172111..e4bca62bcf14 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
@@ -35,7 +35,7 @@
static const struct dma_fence_ops amdgpu_userq_fence_ops;
static struct kmem_cache *amdgpu_userq_fence_slab;
-#define AMDGPU_USERQ_MAX_HANDLES (1U << 16)
+#define AMDGPU_USERQ_MAX_HANDLES U16_MAX
int amdgpu_userq_fence_slab_init(void)
{
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amdgpu: Fix incorrect max handle limit in userq wait ioctl
2026-02-25 7:20 [PATCH] drm/amdgpu: Fix incorrect max handle limit in userq wait ioctl Srinivasan Shanmugam
@ 2026-02-25 8:01 ` Christian König
0 siblings, 0 replies; 2+ messages in thread
From: Christian König @ 2026-02-25 8:01 UTC (permalink / raw)
To: Srinivasan Shanmugam, Alex Deucher; +Cc: amd-gfx
On 2/25/26 08:20, Srinivasan Shanmugam wrote:
> Clang reports that a comparison in amdgpu_userq_wait_ioctl()
> is always false.
>
> The field num_syncobj_timeline_handles is defined as __u16.
> A __u16 value can only go up to 65535.
>
> But AMDGPU_USERQ_MAX_HANDLES was defined as 65536.
> So the check comparing the field with this limit could
> never be true.
>
> Change the limit to U16_MAX (65535) to match the field type.
>
> Fixes the below:
> amdgpu_userq_fence.c:642:46: warning: result of comparison of constant 65536 with expression of type '__u16' (aka 'unsigned short') is always false [-Wtautological-constant-out-of-range-compare]
Well that means that we actually don't need this check.
Adjusting the value just works around the problem.
Regards,
Christian.
> wait_info->num_syncobj_timeline_handles > AMDGPU_USERQ_MAX_HANDLES ||
>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> index 136071172111..e4bca62bcf14 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_userq_fence.c
> @@ -35,7 +35,7 @@
> static const struct dma_fence_ops amdgpu_userq_fence_ops;
> static struct kmem_cache *amdgpu_userq_fence_slab;
>
> -#define AMDGPU_USERQ_MAX_HANDLES (1U << 16)
> +#define AMDGPU_USERQ_MAX_HANDLES U16_MAX
>
> int amdgpu_userq_fence_slab_init(void)
> {
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-25 8:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-25 7:20 [PATCH] drm/amdgpu: Fix incorrect max handle limit in userq wait ioctl Srinivasan Shanmugam
2026-02-25 8:01 ` Christian König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox