AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Patch v1] drm/amdkfd: add missing return value check for range
@ 2025-10-24  4:47 Sunil Khatri
  2025-10-24 11:09 ` Khatri, Sunil
  0 siblings, 1 reply; 3+ messages in thread
From: Sunil Khatri @ 2025-10-24  4:47 UTC (permalink / raw)
  To: Christian König, Felix Kuehling, Alex Deucher,
	Arunpravin Paneer Selvam, amd-gfx
  Cc: Sunil Khatri

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 <sunil.khatri@amd.com>
---
 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);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-10-27 14:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-24  4:47 [Patch v1] drm/amdkfd: add missing return value check for range Sunil Khatri
2025-10-24 11:09 ` Khatri, Sunil
2025-10-27 14:43   ` Christian König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox