[Mesa-dev] [PATCH] anv: Add missing error-checking to anv_block_pool_init
Mun Gwan-gyeong
elongbug at gmail.com
Sun Nov 20 11:11:17 UTC 2016
When the allocation fails on u_vector_init(), it returns 0
This fixes u_vector_init failure path on anv_block_pool_init
CID 1394319
Signed-off-by: Mun Gwan-gyeong <elongbug at gmail.com>
---
src/intel/vulkan/anv_allocator.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/intel/vulkan/anv_allocator.c b/src/intel/vulkan/anv_allocator.c
index f472213..30bbd69 100644
--- a/src/intel/vulkan/anv_allocator.c
+++ b/src/intel/vulkan/anv_allocator.c
@@ -269,8 +269,10 @@ anv_block_pool_init(struct anv_block_pool *pool,
if (ftruncate(pool->fd, BLOCK_POOL_MEMFD_SIZE) == -1)
return;
- u_vector_init(&pool->mmap_cleanups,
- round_to_power_of_two(sizeof(struct anv_mmap_cleanup)), 128);
+ if (!u_vector_init(&pool->mmap_cleanups,
+ round_to_power_of_two(sizeof(struct anv_mmap_cleanup)),
+ 128))
+ return;
pool->state.next = 0;
pool->state.end = 0;
--
2.10.2
More information about the mesa-dev
mailing list