Return INVALID_ARGUMENT for system-allocated pointers in kernelSetArg

Change-Id: I5ad50f8d60c5a54aedf24484a65400352ec855df
Signed-off: Jaime Arteaga <jaime.a.arteaga.molina@intel.com>
This commit is contained in:
Jaime Arteaga
2020-06-10 12:06:10 -07:00
committed by sys_ocldev
parent 851e894ab6
commit 59da9598aa
2 changed files with 16 additions and 0 deletions

View File

@@ -487,6 +487,9 @@ ze_result_t KernelImp::setArgBuffer(uint32_t argIndex, size_t argSize, const voi
auto requestedAddress = *reinterpret_cast<void *const *>(argVal);
auto svmAllocsManager = module->getDevice()->getDriverHandle()->getSvmAllocsManager();
if (nullptr == svmAllocsManager->getSVMAlloc(requestedAddress)) {
return ZE_RESULT_ERROR_INVALID_ARGUMENT;
}
NEO::GraphicsAllocation *alloc = svmAllocsManager->getSVMAlloc(requestedAddress)->gpuAllocation;
auto gpuAddress = reinterpret_cast<uintptr_t>(requestedAddress);
return setArgBufferWithAlloc(argIndex, gpuAddress, alloc);