Mesa (main): vulkan/runtime: 0-out pipeline cache object
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon May 2 19:25:42 UTC 2022
Module: Mesa
Branch: main
Commit: 1e7ea180268668880b2f3fff853d1f071da04492
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e7ea180268668880b2f3fff853d1f071da04492
Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date: Mon May 2 16:32:36 2022 +0300
vulkan/runtime: 0-out pipeline cache object
I'm running into crashes because cache->cache_object is uninitialized.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Fixes: 591da9877900 ("vulkan: Add a common VkPipelineCache implementation")
Reviewed-by: Jason Ekstrand <jason.ekstrand at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16275>
---
src/vulkan/runtime/vk_pipeline_cache.c | 4 ++--
src/vulkan/runtime/vk_pipeline_cache.h | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/vulkan/runtime/vk_pipeline_cache.c b/src/vulkan/runtime/vk_pipeline_cache.c
index 87310eb8dec..6ed7a397203 100644
--- a/src/vulkan/runtime/vk_pipeline_cache.c
+++ b/src/vulkan/runtime/vk_pipeline_cache.c
@@ -562,8 +562,8 @@ vk_pipeline_cache_create(struct vk_device *device,
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO);
- cache = vk_object_alloc(device, pAllocator, sizeof(*cache),
- VK_OBJECT_TYPE_PIPELINE_CACHE);
+ cache = vk_object_zalloc(device, pAllocator, sizeof(*cache),
+ VK_OBJECT_TYPE_PIPELINE_CACHE);
if (cache == NULL)
return NULL;
diff --git a/src/vulkan/runtime/vk_pipeline_cache.h b/src/vulkan/runtime/vk_pipeline_cache.h
index 2d1eeb1d231..37fe2e7b85c 100644
--- a/src/vulkan/runtime/vk_pipeline_cache.h
+++ b/src/vulkan/runtime/vk_pipeline_cache.h
@@ -120,6 +120,7 @@ vk_pipeline_cache_object_init(struct vk_device *device,
const struct vk_pipeline_cache_object_ops *ops,
const void *key_data, uint32_t key_size)
{
+ memset(object, 0, sizeof(*object));
object->device = device;
object->ops = ops;
p_atomic_set(&object->ref_cnt, 1);
More information about the mesa-commit
mailing list