From: Dave Airlie Date: Fri, 17 Jul 2020 01:30:25 +0000 (+1000) Subject: vallium: limit buffer allocations to gallium max. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=668e4c235657ba230eab326d5001f60f37e403c3;p=mesa.git vallium: limit buffer allocations to gallium max. Don't allocate buffers greater than gallium can handle. Fixes: dEQP-VK.api.buffer.basic.size_max_uint64 Fixes: b38879f8c5f57b7f1802 ("vallium: initial import of the vulkan frontend") Reviewed-by: Roland Scheidegger Part-of: --- diff --git a/src/gallium/frontends/vallium/val_image.c b/src/gallium/frontends/vallium/val_image.c index 29a493e77fe..b40e5b9dccb 100644 --- a/src/gallium/frontends/vallium/val_image.c +++ b/src/gallium/frontends/vallium/val_image.c @@ -198,6 +198,10 @@ VkResult val_CreateBuffer( assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO); + /* gallium has max 32-bit buffer sizes */ + if (pCreateInfo->size > UINT32_MAX) + return VK_ERROR_OUT_OF_DEVICE_MEMORY; + buffer = vk_alloc2(&device->alloc, pAllocator, sizeof(*buffer), 8, VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); if (buffer == NULL)