From 434df667929b6c2561ddf8ebf1be4b111884f456 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= Date: Wed, 6 Oct 2021 13:14:20 +0200 Subject: [PATCH] anv: allocate zeroed device object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When enabling a new feature we made the mistake of initializing some fields of the device object conditionally, which leads to crashes later. Initializing those fields would be a trivial fix, but it's probably better to just zero everything at allocation time and prevent any future screwups. Device objects are allocated rarely enough for this additional memset to not matter for performance. Signed-off-by: Marcin Ĺšlusarz Reviewed-by: Lionel Landwerlin Reviewed-by: Jason Ekstrand Part-of: --- src/intel/vulkan/anv_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 17c2df0c2aa..8c334302bd1 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -2922,7 +2922,7 @@ VkResult anv_CreateDevice( queue_priority ? queue_priority->globalPriority : VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT; - device = vk_alloc2(&physical_device->instance->vk.alloc, pAllocator, + device = vk_zalloc2(&physical_device->instance->vk.alloc, pAllocator, sizeof(*device), 8, VK_SYSTEM_ALLOCATION_SCOPE_DEVICE); if (!device)