From bc09c95a1777fec6bf57f3fc3755fb8952d3ad5f Mon Sep 17 00:00:00 2001 From: Maciej Plewka Date: Thu, 30 Apr 2020 14:43:25 +0200 Subject: [PATCH] Use memcpy_s instead of memcpy Change-Id: I14ae0f782f38f21fa5a1ce1fd7125e97065b5a61 Signed-off-by: Maciej Plewka --- level_zero/core/source/cmdlist/cmdlist_hw.inl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/level_zero/core/source/cmdlist/cmdlist_hw.inl b/level_zero/core/source/cmdlist/cmdlist_hw.inl index 9354eb423e..a2254b35b4 100644 --- a/level_zero/core/source/cmdlist/cmdlist_hw.inl +++ b/level_zero/core/source/cmdlist/cmdlist_hw.inl @@ -1098,7 +1098,7 @@ ze_result_t CommandListCoreFamily::appendBlitFill(void *ptr, auto internalAlloc = device->getNEODevice()->getMemoryManager()->allocateGraphicsMemoryWithProperties(properties); size_t offset = 0; for (uint32_t i = 0; i < size / patternSize; i++) { - memcpy(ptrOffset(internalAlloc->getDriverAllocatedCpuPtr(), offset), pattern, patternSize); + memcpy_s(ptrOffset(internalAlloc->getDriverAllocatedCpuPtr(), offset), (internalAlloc->getUnderlyingBufferSize() - offset), pattern, patternSize); offset += patternSize; } auto ret = appendMemoryCopy(ptr, internalAlloc->getDriverAllocatedCpuPtr(), size, hEvent, 0, nullptr); @@ -1113,7 +1113,7 @@ ze_result_t CommandListCoreFamily::appendBlitFill(void *ptr, } commandContainer.addToResidencyContainer(allocData->gpuAllocation); uint32_t patternToCommand[4] = {}; - memcpy(&patternToCommand, pattern, patternSize); + memcpy_s(&patternToCommand, sizeof(patternToCommand), pattern, patternSize); NEO::BlitCommandsHelper::dispatchBlitMemoryColorFill(allocData->gpuAllocation, patternToCommand, patternSize, *commandContainer.getCommandStream(), size, *device->getNEODevice()->getExecutionEnvironment()->rootDeviceEnvironments[device->getRootDeviceIndex()]); if (hEvent) { this->appendSignalEventPostWalker(hEvent);