SWDEV-374363 - hipImportExternalMemory/Semaphore should return error

when the Memory/Semaphore handle desc type is invalid

Change-Id: If122b05d87cc65974a797da69c134e2ac264d1db
Este commit está contenido en:
Satyanvesh Dittakavi
2023-03-17 08:16:45 +00:00
cometido por Maneesh Gupta
padre 0b4f845475
commit 1ed823a477
+11
Ver fichero
@@ -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