mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 00:38:48 +02:00
winsys/amdgpu: pointers to be NULL if num 0 for kernel ioctl
From https://docs.kernel.org/process/botching-up-ioctls.html, Kernel ioctl expects pointers are NULL if number of pointers variable is 0. Kernel ioctl can have checks for these and return failure causing the driver to fail. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40698>
This commit is contained in:
parent
58d45725c7
commit
5df6fc5481
1 changed files with 6 additions and 7 deletions
|
|
@ -1623,17 +1623,16 @@ static int amdgpu_cs_submit_ib_userq(struct amdgpu_userq *userq,
|
|||
struct amdgpu_winsys *aws = acs->aws;
|
||||
struct amdgpu_cs_context *csc = amdgpu_csc_get_submitted(acs);
|
||||
|
||||
/* Syncobj dependencies. */
|
||||
unsigned num_syncobj_dependencies = csc->syncobj_dependencies.num;
|
||||
uint32_t *syncobj_dependencies_list =
|
||||
(uint32_t*)alloca(num_syncobj_dependencies * sizeof(uint32_t));
|
||||
|
||||
/* Currently only 1 vm timeline syncobj can be a dependency. */
|
||||
uint16_t num_syncobj_timeline_dependencies = 1;
|
||||
uint32_t syncobj_timeline_dependency;
|
||||
uint64_t syncobj_timeline_dependency_point;
|
||||
|
||||
/* Syncobj dependencies. */
|
||||
unsigned num_syncobj_dependencies = csc->syncobj_dependencies.num;
|
||||
uint32_t *syncobj_dependencies_list = NULL;
|
||||
if (num_syncobj_dependencies) {
|
||||
syncobj_dependencies_list = (uint32_t*)alloca(num_syncobj_dependencies * sizeof(uint32_t));
|
||||
for (unsigned i = 0; i < num_syncobj_dependencies; i++) {
|
||||
struct amdgpu_fence *fence =
|
||||
(struct amdgpu_fence*)csc->syncobj_dependencies.list[i];
|
||||
|
|
@ -1665,9 +1664,9 @@ static int amdgpu_cs_submit_ib_userq(struct amdgpu_userq *userq,
|
|||
.syncobj_timeline_handles = (uintptr_t)&syncobj_timeline_dependency,
|
||||
.syncobj_timeline_points = (uintptr_t)&syncobj_timeline_dependency_point,
|
||||
/* Wait for previous reads/writes to complete before writing to these BOs. */
|
||||
.bo_read_handles = (uintptr_t)shared_buf_kms_handles_write,
|
||||
.bo_read_handles = num_shared_buf_write ? (uintptr_t)shared_buf_kms_handles_write : 0,
|
||||
/* Wait for previous writes to complete before reading from these BOs. */
|
||||
.bo_write_handles = (uintptr_t)shared_buf_kms_handles_read,
|
||||
.bo_write_handles = num_shared_buf_read ? (uintptr_t)shared_buf_kms_handles_read : 0,
|
||||
.num_syncobj_timeline_handles = num_syncobj_timeline_dependencies,
|
||||
.num_fences = 0,
|
||||
.num_syncobj_handles = num_syncobj_dependencies,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue