drm/amdkfd: add missing return value check for range
Subsystems (3)
PATCH 1/1 drm/amdkfd: add missing return value check for range
amdgpu_hmm_range_alloc could fails in case of low
memory condition and hence we should have a check
for the return value.
Signed-off-by Sunil Khatri <[email protected]>
--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_svm.c +3 -0
@@ -1738,6 +1738,9 @@ static int svm_range_validate_and_map(struct mm_struct *mm,WRITE_ONCE (p->svms.faulting_task, current); range =amdgpu_hmm_range_alloc (NULL ); +if (unlikely (!range)) +return -ENOMEM ; + r =amdgpu_hmm_range_get_pages (&prange->notifier, addr, npages, readonly, owner, range);
Signature · 1 line
2.34.1
+philip
Quoted 23 lines · Sunil Khatri
amdgpu_hmm_range_alloccould fails in case of low
memory condition and hence we should have a check
for the return value.Signed-off-by Sunil Khatri <[email protected]>--- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 3 +++ 1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_svm.c +3
-0@@ -1738,6 +1738,9 @@ static int svm_range_validate_and_map(struct mm_struct *mm,WRITE_ONCE (p->svms.faulting_task, current); range =amdgpu_hmm_range_alloc (NULL ); +if (unlikely (!range)) +return -ENOMEM ; + r =amdgpu_hmm_range_get_pages (&prange->notifier, addr, npages, readonly, owner, range);
Quoted 8 lines · Sunil
+philip
Quoted 5 lines · Sunil Khatri
amdgpu_hmm_range_alloccould fails in case of low
memory condition and hence we should have a check
for the return value.Signed-off-by Sunil Khatri <[email protected]>
Reviewed-by Christian König <[email protected]>
Quoted 17 lines
Quoted 17 lines
---
drivers/gpu/drm/amd/amdkfd/kfd_svm.c| 3 +++1 file changed, 3 insertions(+)drivers/gpu/drm/amd/amdkfd/kfd_svm.c +3
-0@@ -1738,6 +1738,9 @@ static int svm_range_validate_and_map(struct mm_struct *mm, WRITE_ONCE(p->svms.faulting_task, current); range = amdgpu_hmm_range_alloc(NULL); + if (unlikely(!range)) + return -ENOMEM; + r = amdgpu_hmm_range_get_pages(&prange->notifier, addr, npages, readonly, owner, range);