Skip to content

Commit c1c9cad

Browse files
harshimogalapallilucasdemarchi
authored andcommitted
drm/xe/svm: fix dereferencing error pointer in drm_gpusvm_range_alloc()
xe_svm_range_alloc() returns ERR_PTR(-ENOMEM) on failure and there is a dereference of "range" after that: --> range->gpusvm = gpusvm; In xe_svm_range_alloc(), when memory allocation fails return NULL instead to handle this situation. Fixes: 99624bd ("drm/gpusvm: Add support for GPU Shared Virtual Memory") Reported-by: Dan Carpenter <[email protected]> Closes: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Harshit Mogalapalli <[email protected]> Reviewed-by: Matthew Brost <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit 7a03221) Signed-off-by: Lucas De Marchi <[email protected]>
1 parent b443265 commit c1c9cad

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/gpu/drm/xe/xe_svm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ xe_svm_range_alloc(struct drm_gpusvm *gpusvm)
7979

8080
range = kzalloc(sizeof(*range), GFP_KERNEL);
8181
if (!range)
82-
return ERR_PTR(-ENOMEM);
82+
return NULL;
8383

8484
INIT_LIST_HEAD(&range->garbage_collector_link);
8585
xe_vm_get(gpusvm_to_vm(gpusvm));

0 commit comments

Comments
 (0)