Module: Mesa
Branch: main
Commit: 715adcb8847c43837314583bbdc8a0a1a03d2903
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=715adcb8847c43837314583bbdc8a0a1a03d2903

Author: Mark Collins <[email protected]>
Date:   Thu Mar  9 23:50:57 2023 +0000

tu: fix tu_GetInstanceProcAddr not handling null instance

It is legal to pass in nullptr as an instance into
vkGetInstanceProcAddr when resolving any global addresses, this
wasn't handled correctly and an illegal access to a member of
a null struct was made.

Signed-off-by: Mark Collins <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21827>

---

 src/freedreno/vulkan/tu_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c
index 9d25cca72c4..3b82ec5d3db 100644
--- a/src/freedreno/vulkan/tu_device.c
+++ b/src/freedreno/vulkan/tu_device.c
@@ -2515,7 +2515,7 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL
 tu_GetInstanceProcAddr(VkInstance _instance, const char *pName)
 {
    TU_FROM_HANDLE(tu_instance, instance, _instance);
-   return vk_instance_get_proc_addr(&instance->vk,
+   return vk_instance_get_proc_addr(instance != NULL ? &instance->vk : NULL,
                                     &tu_instance_entrypoints,
                                     pName);
 }

Reply via email to