diff options
author | Samuel Pitoiset <[email protected]> | 2020-07-14 09:48:56 +0200 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2020-07-16 09:46:31 +0200 |
commit | 40bea60dcf9d29f8c6d73ff5418f431ed7fcc318 (patch) | |
tree | 2accde510290e3a8de5e08fcda4f05ad0b6e8f3e /src/amd | |
parent | 97f8ec321b73975bf6a3ed997c10381942e9f19e (diff) |
radv/winsys: replace alloca() by malloc() everywhere
To remove the mix of alloca() and malloc().
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5899>
Diffstat (limited to 'src/amd')
-rw-r--r-- | src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c index 7f391a60a72..eaa85f27a08 100644 --- a/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c +++ b/src/amd/vulkan/winsys/amdgpu/radv_amdgpu_cs.c @@ -1460,11 +1460,17 @@ static int radv_amdgpu_cs_submit(struct radv_amdgpu_ctx *ctx, user_fence = (request->fence_info.handle != NULL); size = request->number_of_ibs + (user_fence ? 2 : 1) + 3; - chunks = alloca(sizeof(struct drm_amdgpu_cs_chunk) * size); + chunks = malloc(sizeof(chunks[0]) * size); + if (!chunks) + return -ENOMEM; size = request->number_of_ibs + (user_fence ? 1 : 0); - chunk_data = alloca(sizeof(struct drm_amdgpu_cs_chunk_data) * size); + chunk_data = malloc(sizeof(chunk_data[0]) * size); + if (!chunk_data) { + r = -ENOMEM; + goto error_out; + } num_chunks = request->number_of_ibs; for (i = 0; i < request->number_of_ibs; i++) { @@ -1511,7 +1517,12 @@ static int radv_amdgpu_cs_submit(struct radv_amdgpu_ctx *ctx, } if (sem_info->wait.sem_count && sem_info->cs_emit_wait) { - sem_dependencies = alloca(sizeof(struct drm_amdgpu_cs_chunk_dep) * sem_info->wait.sem_count); + sem_dependencies = malloc(sizeof(sem_dependencies[0]) * sem_info->wait.sem_count); + if (!sem_dependencies) { + r = -ENOMEM; + goto error_out; + } + int sem_count = 0; for (unsigned j = 0; j < sem_info->wait.sem_count; j++) { @@ -1552,6 +1563,9 @@ static int radv_amdgpu_cs_submit(struct radv_amdgpu_ctx *ctx, chunks, &request->seq_no); error_out: + free(chunks); + free(chunk_data); + free(sem_dependencies); free(wait_syncobj); free(signal_syncobj); return r; |