From 14bca200be48c3e6e5fde2b07f377b622c1744a1 Mon Sep 17 00:00:00 2001 From: Erik Faye-Lund Date: Wed, 27 Nov 2024 17:16:56 +0100 Subject: [PATCH] panvk: widen type before multiplying This function returns an uint64_t, but returns the result of two uint32_t values. If we don't widen at least one of them before returning, the multiplication wraps large results. So let's widen the type first, so we can preserve large offsets. Fixes: d1934e44fc8 ("panvk: Implement occlusion queries for JM") Reviewed-by: Boris Brezillon Reviewed-by: Mary Guillemard CID: 1634943 Part-of: --- src/panfrost/vulkan/panvk_query_pool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panfrost/vulkan/panvk_query_pool.h b/src/panfrost/vulkan/panvk_query_pool.h index 32fea884ff7..bb8c1057d66 100644 --- a/src/panfrost/vulkan/panvk_query_pool.h +++ b/src/panfrost/vulkan/panvk_query_pool.h @@ -65,7 +65,7 @@ static uint64_t panvk_query_offset(struct panvk_query_pool *pool, uint32_t query) { assert(query < pool->vk.query_count); - return query * pool->query_stride; + return query * (uint64_t)pool->query_stride; } static uint64_t