From 9805fb774e32a6adfadd7a944f6eb35386a53c2d Mon Sep 17 00:00:00 2001 From: Satyanvesh Dittakavi Date: Thu, 19 Aug 2021 14:59:11 +0000 Subject: [PATCH] SWDEV-299491 - Update data index in GetSvmAttributes appropriately Fixes Seg fault caused when the attribute hipMemRangeAttributeAccessedBy is queried using hipMemRangeGetAttribute Change-Id: I2ceb2267d89bfc31a55d9eae2685610c7ad89b1f [ROCm/clr commit: 48c1b895c00119c965984c02844b0ecf27eb6d19] --- projects/clr/rocclr/device/rocm/rocdevice.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/clr/rocclr/device/rocm/rocdevice.cpp b/projects/clr/rocclr/device/rocm/rocdevice.cpp index e54736ccd9..967dc313eb 100644 --- a/projects/clr/rocclr/device/rocm/rocdevice.cpp +++ b/projects/clr/rocclr/device/rocm/rocdevice.cpp @@ -2477,8 +2477,8 @@ bool Device::GetSvmAttributes(void** data, size_t* data_sizes, int* attributes, } } rocr_attr += accessed_by; - for (uint32_t idx = entry; idx < device_count; ++idx) { - reinterpret_cast(data[idx])[idx] = + for (uint32_t i = entry; i < device_count; ++i) { + reinterpret_cast(data[idx])[i] = static_cast(amd::InvalidDeviceId); } break;