[Mesa-dev] [PATCH] anv: Add missing error-checking to anv_block_pool_init

Mun, Gwan-gyeong elongbug at gmail.com
Mon Nov 21 12:52:10 UTC 2016


Hi Nayan Deshmukh,

Thanks for reviewing. As I do not have the permission of mesa git, If
you have permission for git push, can you push this patch?

Best regards,

Gwan-gyeong.

2016-11-20 20:44 GMT+09:00 Nayan Deshmukh <nayan26deshmukh at gmail.com>:
> 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



-- 
Mun, Gwan-gyeong


More information about the mesa-dev mailing list