SWDEV-301069 - null ptr check before calling getUserData

Change-Id: Iaff3acd44d89a9629efe0672cb45138942d7fa28
This commit is contained in:
Ajay authored and Ajay GunaShekar committed 2021-09-17 19:25:24 -04:00
1 vanhempi 29adfcd3c0
commit 198530143c
2 files changed
+6 -9

No files matched your search

+2 -2
Näytä tiedosto
@@ -228,12 +228,12 @@ hipError_t ihipMallocManaged(void** ptr, size_t size, unsigned int align) {
size, (align == 0) ? dev.info().memBaseAddrAlign_ : align);
size_t offset = 0; //this is ignored
amd::Memory* memObj = getMemoryObject(*ptr, offset);
//saves the current device id so that it can be accessed later
memObj->getUserData().deviceId = hip::getCurrentDevice()->deviceId();
if (*ptr == nullptr) {
return hipErrorMemoryAllocation;
}
//saves the current device id so that it can be accessed later
memObj->getUserData().deviceId = hip::getCurrentDevice()->deviceId();
ClPrint(amd::LOG_INFO, amd::LOG_API, "ihipMallocManaged ptr=0x%zx", *ptr);
return hipSuccess;