SWDEV-374363 - hipImportExternalMemory/Semaphore should return error

when the Memory/Semaphore handle desc type is invalid

Change-Id: If122b05d87cc65974a797da69c134e2ac264d1db


[ROCm/clr commit: 1ed823a477]
This commit is contained in:
Satyanvesh Dittakavi
2023-03-17 08:16:45 +00:00
committed by Maneesh Gupta
parent ec1aea4a1b
commit dded7831c1
+11
View File
@@ -109,6 +109,11 @@ hipError_t hipImportExternalMemory(
HIP_RETURN(hipErrorInvalidValue);
}
if ((memHandleDesc->type < hipExternalMemoryHandleTypeOpaqueFd) ||
(memHandleDesc->type > hipExternalMemoryHandleTypeD3D11ResourceKmt)) {
HIP_RETURN(hipErrorInvalidValue);
}
size_t sizeBytes = memHandleDesc->size;
amd::Context& amdContext = *hip::getCurrentDevice()->asContext();
@@ -173,6 +178,12 @@ hipError_t hipImportExternalSemaphore(hipExternalSemaphore_t* extSem_out,
if (extSem_out == nullptr || semHandleDesc == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if ((semHandleDesc->type < hipExternalSemaphoreHandleTypeOpaqueFd) ||
(semHandleDesc->type > hipExternalSemaphoreHandleTypeD3D12Fence)) {
HIP_RETURN(hipErrorInvalidValue);
}
amd::Device* device = hip::getCurrentDevice()->devices()[0];
#ifdef _WIN32