+philip

On 24-10-2025 10:17 am, Sunil Khatri wrote:
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(+)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c 
b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
index f041643308ca..bc07aa3af2ab 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_svm.c
@@ -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);

Reply via email to