s/Intel: fix/anv: fix: potentially overflowing expression in genX

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 <lionel.g.landwerlin@intel.com>
Reviewed-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Illia Polishchuk <illia.a.polishchuk@globallogic.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20893>
This commit is contained in:
Illia Polishchuk
2023-05-08 03:56:53 +03:00
committed by Marge Bot
parent 1cbf10ca88
commit c2724b4d37

View File

@@ -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,