SWDEV-386695 - fix param sanitization check

Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: I1317640453d56718fa41f455c512282fd0f01e2a
이 커밋은 다음에 포함됨:
sdashmiz 작성하고 Maneesh Gupta가 2023-04-05 10:53:42 +00:00를 커밋함
1 부모 7809d2846b
커밋 3a45a965e2
1 파일이 변경됨
+10
+10
파일 보기
@@ -2162,6 +2162,16 @@ hipError_t hipGraphAddMemAllocNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
(numDependencies > 0 && pDependencies == nullptr) || pNodeParams == nullptr) {
HIP_RETURN(hipErrorInvalidValue);
}
if (pNodeParams->bytesize == 0 || pNodeParams->poolProps.allocType != hipMemAllocationTypePinned
|| pNodeParams->poolProps.location.type != hipMemLocationTypeDevice) {
pNodeParams->dptr = nullptr;
HIP_RETURN(hipErrorInvalidValue);
}
if (pNodeParams->poolProps.location.type == hipMemLocationTypeDevice) {
if (pNodeParams->poolProps.location.id < 0 || pNodeParams->poolProps.location.id >= g_devices.size()) {
HIP_RETURN(hipErrorInvalidValue);
}
}
// Clear the pointer to allocated memory because it may contain stale/uninitialized data
pNodeParams->dptr = nullptr;
auto mem_alloc_node = new hipGraphMemAllocNode(pNodeParams);