anv: assert that the target bo is valid when adding a reloc list

this catches some undefined behavior like e.g., using a stale descriptorset
that references deleted bos, which I would absolutely never do

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6747>
This commit is contained in:
Mike Blumenkrantz 2020-09-16 12:38:58 -04:00 committed by Marge Bot
parent 355f241d41
commit b75a92e201
1 changed files with 2 additions and 0 deletions

View File

@ -200,6 +200,8 @@ anv_reloc_list_add(struct anv_reloc_list *list,
if (result != VK_SUCCESS)
return result;
assert(target_bo->gem_handle > 0 && target_bo->refcount > 0);
/* XXX: Can we use I915_EXEC_HANDLE_LUT? */
index = list->num_relocs++;
list->reloc_bos[index] = target_bo;