From ff5cb90880a24ed97770180d1f409d259a78ddd9 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Thu, 22 May 2025 09:37:24 -0700 Subject: [PATCH] anv: avoid potential integer overflow Coverity points out that we're using a 32bit type on the left side here, so the entire operation is done as 32 bit instead of 64 CID: 1646960 Reviewed-by: Lionel Landwerlin Part-of: --- src/intel/vulkan/anv_slab_bo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_slab_bo.c b/src/intel/vulkan/anv_slab_bo.c index d8f0ea4e5b9..1aa631bbc0f 100644 --- a/src/intel/vulkan/anv_slab_bo.c +++ b/src/intel/vulkan/anv_slab_bo.c @@ -134,7 +134,7 @@ anv_slab_bo_alloc(struct anv_device *device, const char *name, uint64_t requeste const unsigned num_slab_allocator = ARRAY_SIZE(device->bo_slabs); struct pb_slabs *last_slab = &device->bo_slabs[num_slab_allocator - 1]; - const uint64_t max_slab_entry_size = 1 << (last_slab->min_order + last_slab->num_orders - 1); + const uint64_t max_slab_entry_size = BITFIELD64_BIT(last_slab->min_order + last_slab->num_orders - 1); if (requested_size > max_slab_entry_size) return NULL;