drm/amdgpu: add missing NULL check
authorjsg <jsg@openbsd.org>
Fri, 20 Oct 2023 03:45:42 +0000 (03:45 +0000)
committerjsg <jsg@openbsd.org>
Fri, 20 Oct 2023 03:45:42 +0000 (03:45 +0000)
From Christian Koenig
a61d905a86879427e330a5a66cba8b2330dac4d1 in linux-6.1.y/6.1.59
ff89f064dca38e2203790bf876cc7756b8ab2961 in mainline linux

sys/dev/pci/drm/amd/amdgpu/amdgpu_object.h

index db2ddf1..6dc788b 100644 (file)
@@ -221,7 +221,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
        struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
        struct amdgpu_res_cursor cursor;
 
-       if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
+       if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
                return false;
 
        amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);