Skip to content

Commit 040b35c

Browse files
zackrChristianKoenigAMD
authored andcommitted
drm/ttm: Fix a regression causing kernel oops'es
The branch is explicitly taken if ttm == NULL which means that to avoid a null pointer reference the ttm object can not be used inside. Switch back to dst_mem to avoid kernel oops'es. This fixes kernel oops'es with any buffer objects which don't have ttm_tt, e.g. with vram based screen objects on vmwgfx. Signed-off-by: Zack Rusin <[email protected]> Fixes: e3c92eb ("drm/ttm: rework on ttm_resource to use size_t type") Cc: Somalapuram Amaranath <[email protected]> Cc: Christian König <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Christian König <[email protected]>
1 parent 4e2ec25 commit 040b35c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/ttm/ttm_bo_util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
173173

174174
clear = src_iter->ops->maps_tt && (!ttm || !ttm_tt_is_populated(ttm));
175175
if (!(clear && ttm && !(ttm->page_flags & TTM_TT_FLAG_ZERO_ALLOC)))
176-
ttm_move_memcpy(clear, ttm->num_pages, dst_iter, src_iter);
176+
ttm_move_memcpy(clear, PFN_UP(dst_mem->size), dst_iter, src_iter);
177177

178178
if (!src_iter->ops->maps_tt)
179179
ttm_kmap_iter_linear_io_fini(&_src_iter.io, bdev, src_mem);

0 commit comments

Comments
 (0)