Skip to content

Commit ff89f06

Browse files
ChristianKoenigAMDalexdeucher
authored andcommitted
drm/amdgpu: add missing NULL check
bo->tbo.resource can easily be NULL here. Link: https://gitlab.freedesktop.org/drm/amd/-/issues/2902 Signed-off-by: Christian König <[email protected]> Reviewed-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]> CC: [email protected]
1 parent 23645bc commit ff89f06

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/amd/amdgpu/amdgpu_object.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ static inline bool amdgpu_bo_in_cpu_visible_vram(struct amdgpu_bo *bo)
252252
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->tbo.bdev);
253253
struct amdgpu_res_cursor cursor;
254254

255-
if (bo->tbo.resource->mem_type != TTM_PL_VRAM)
255+
if (!bo->tbo.resource || bo->tbo.resource->mem_type != TTM_PL_VRAM)
256256
return false;
257257

258258
amdgpu_res_first(bo->tbo.resource, 0, amdgpu_bo_size(bo), &cursor);

0 commit comments

Comments
 (0)