diff options
author | Jason Ekstrand <[email protected]> | 2015-10-15 17:24:32 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2015-10-15 17:24:32 -0700 |
commit | 298d0316427315ce78ab6aaaaec7e6dd31a31292 (patch) | |
tree | 08542270de0d4445828751d3d7c3a0fa17a0ef35 /src | |
parent | 3130851add25d8008d40ca332cfd3b2b4527c0f9 (diff) |
anv/batch_chain: Add some sanity-check asserts for relocations
Diffstat (limited to 'src')
-rw-r--r-- | src/vulkan/anv_batch_chain.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/vulkan/anv_batch_chain.c b/src/vulkan/anv_batch_chain.c index 77fbd6635c0..239149709df 100644 --- a/src/vulkan/anv_batch_chain.c +++ b/src/vulkan/anv_batch_chain.c @@ -830,8 +830,11 @@ anv_cmd_buffer_add_bo(struct anv_cmd_buffer *cmd_buffer, obj->relocation_count = relocs->num_relocs; obj->relocs_ptr = (uintptr_t) relocs->relocs; - for (size_t i = 0; i < relocs->num_relocs; i++) + for (size_t i = 0; i < relocs->num_relocs; i++) { + /* A quick sanity check on relocations */ + assert(relocs->relocs[i].offset < bo->size); anv_cmd_buffer_add_bo(cmd_buffer, relocs->reloc_bos[i], NULL); + } } return VK_SUCCESS; @@ -872,6 +875,7 @@ adjust_relocations_from_block_pool(struct anv_block_pool *pool, * offset to what it is now based on the delta and the data in the * block pool. Then the kernel will update it for us if needed. */ + assert(relocs->relocs[i].offset < pool->state.end); uint32_t *reloc_data = pool->map + relocs->relocs[i].offset; relocs->relocs[i].presumed_offset = *reloc_data - relocs->relocs[i].delta; @@ -913,6 +917,7 @@ adjust_relocations_to_block_pool(struct anv_block_pool *pool, * should only be called on batch buffers, so we know it isn't in * use by the GPU at the moment. */ + assert(relocs->relocs[i].offset < from_bo->size); uint32_t *reloc_data = from_bo->map + relocs->relocs[i].offset; *reloc_data = relocs->relocs[i].presumed_offset + relocs->relocs[i].delta; |