[bug report] drm/amdgpu: Auto-validate DMABuf imports in compute VMs
Dan Carpenter
dan.carpenter at linaro.org
Fri Jan 12 14:29:33 UTC 2024
Hello Felix Kuehling,
This is a semi-automatic email about new static checker warnings.
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c:1480 amdgpu_vm_handle_moved()
warn: variable dereferenced before check 'bo_va->base.bo' (see line 1453)
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
1452 base.vm_status);
1453 resv = bo_va->base.bo->tbo.base.resv;
^^^^^^^^^^^^^^^^
Unchecked dereference
1454 spin_unlock(&vm->status_lock);
1455
1456 /* Try to reserve the BO to avoid clearing its ptes */
1457 if (!adev->debug_vm && dma_resv_trylock(resv)) {
1458 clear = false;
1459 unlock = true;
1460 /* The caller is already holding the reservation lock */
1461 } else if (ticket && dma_resv_locking_ctx(resv) == ticket) {
1462 clear = false;
1463 unlock = false;
1464 /* Somebody else is using the BO right now */
1465 } else {
1466 clear = true;
1467 unlock = false;
1468 }
1469
1470 r = amdgpu_vm_bo_update(adev, bo_va, clear);
1471
1472 if (unlock)
1473 dma_resv_unlock(resv);
1474 if (r)
1475 return r;
1476
1477 /* Remember evicted DMABuf imports in compute VMs for later
1478 * validation
1479 */
1480 if (vm->is_compute_context && bo_va->base.bo &&
^^^^^^^^^^^^^^
The patch adds this NULL check but hopefully it's not required.
1481 bo_va->base.bo->tbo.base.import_attach &&
1482 (!bo_va->base.bo->tbo.resource ||
regards,
dan carpenter
More information about the amd-gfx
mailing list