mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 20:08:06 +02:00
anv: reuse object string for RMV token
The current code is not handling the potential NULL pointer in VkDebugUtilsObjectNameInfoEXT::pObjectName Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Fixes:e1b9a6e4f3("anv: initial RMV support") Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30516> (cherry picked from commitc6bf1f02c4)
This commit is contained in:
parent
f80caae143
commit
719f3a1393
2 changed files with 6 additions and 11 deletions
|
|
@ -104,7 +104,7 @@
|
|||
"description": "anv: reuse object string for RMV token",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "e1b9a6e4f3c1702d68866bec2799b1216812595a",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -100,19 +100,14 @@ VkResult anv_rmv_SetDebugUtilsObjectNameEXT(
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
size_t name_len = strlen(pNameInfo->pObjectName);
|
||||
char *name_buf = malloc(name_len + 1);
|
||||
if (!name_buf) {
|
||||
/*
|
||||
* Silently fail, so that applications may still continue if possible.
|
||||
*/
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
strcpy(name_buf, pNameInfo->pObjectName);
|
||||
struct vk_object_base *object =
|
||||
vk_object_base_from_u64_handle(pNameInfo->objectHandle,
|
||||
pNameInfo->objectType);
|
||||
|
||||
simple_mtx_lock(&device->vk.memory_trace_data.token_mtx);
|
||||
struct vk_rmv_userdata_token token;
|
||||
token.name = name_buf;
|
||||
token.name = vk_strdup(&device->vk.alloc, object->object_name,
|
||||
VK_SYSTEM_ALLOCATION_SCOPE_DEVICE);
|
||||
token.resource_id = vk_rmv_get_resource_id_locked(&device->vk, pNameInfo->objectHandle);
|
||||
|
||||
vk_rmv_emit_token(&device->vk.memory_trace_data, VK_RMV_TOKEN_TYPE_USERDATA, &token);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue