From c2724b4d374d3ddbb47d6853d610cddbea370e80 Mon Sep 17 00:00:00 2001 From: Illia Polishchuk Date: Mon, 8 May 2023 03:56:53 +0300 Subject: [PATCH] s/Intel: fix/anv: fix: potentially overflowing expression in genX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CID 1528164 (#1 of 1): Unintentional integer overflow (OVERFLOW_BEFORE_WIDEN) overflow_before_widen: Potentially overflowing expression pool->n_passes * pool->khr_perf_preamble_stride with type unsigned int (32 bits, unsigned) is evaluated using 32-bit arithmetic, and then used in a context that expects an expression of type uint64_t (64 bits, unsigned). Reviewed-by: Lionel Landwerlin Reviewed-by: José Roberto de Souza Signed-off-by: Illia Polishchuk Part-of: --- src/intel/vulkan/genX_query.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/genX_query.c b/src/intel/vulkan/genX_query.c index 7248fae6af7..e0270ee2692 100644 --- a/src/intel/vulkan/genX_query.c +++ b/src/intel/vulkan/genX_query.c @@ -234,7 +234,7 @@ VkResult genX(CreateQueryPool)( if (pool->type == VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR) { pool->khr_perf_preamble_stride = 32; pool->khr_perf_preambles_offset = size; - size += pool->n_passes * pool->khr_perf_preamble_stride; + size += (uint64_t)pool->n_passes * pool->khr_perf_preamble_stride; } result = anv_device_alloc_bo(device, "query-pool", size,