[Mesa-dev] [PATCH] anv: Add missing error-checking to anv_block_pool_init
Nayan Deshmukh
nayan26deshmukh at gmail.com
Sun Nov 20 11:44:43 UTC 2016
Reviewed-by: Nayan Deshmukh <nayan26deshmukh at gmail.com>
On Sun, Nov 20, 2016 at 4:41 PM, Mun Gwan-gyeong <elongbug at gmail.com> wrote:
> 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
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list