From 60a3077ed437203973380734c212d7c0f64aa8ee Mon Sep 17 00:00:00 2001 From: Jaydeep Patel Date: Mon, 17 Jul 2023 12:48:54 +0000 Subject: [PATCH] SWDEV-410751 - Consider null amd::memory is invalid. Change-Id: I6f175f69e922cf5d7f8128c15754e1310419ccd9 [ROCm/clr commit: a9ff2c5a43deda8fa7e942b70c1e3541281ad8c6] --- projects/clr/hipamd/src/hip_hmm.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/clr/hipamd/src/hip_hmm.cpp b/projects/clr/hipamd/src/hip_hmm.cpp index 2bcb832a0d..2e9c03ff1b 100644 --- a/projects/clr/hipamd/src/hip_hmm.cpp +++ b/projects/clr/hipamd/src/hip_hmm.cpp @@ -87,7 +87,7 @@ hipError_t hipMemPrefetchAsync(const void* dev_ptr, size_t count, int device, size_t offset = 0; amd::Memory* memObj = getMemoryObject(dev_ptr, offset); - if ((memObj != nullptr) && (count > (memObj->getSize() - offset))) { + if (memObj == nullptr || (memObj && count > (memObj->getSize() - offset))) { HIP_RETURN(hipErrorInvalidValue); } if (device != hipCpuDeviceId && (static_cast(device) >= g_devices.size())) {