SWDEV-386695 - fix param sanitization check
Signed-off-by: sdashmiz <shadi.dashmiz@amd.com>
Change-Id: I1317640453d56718fa41f455c512282fd0f01e2a
[ROCm/clr commit: 3a45a965e2]
This commit is contained in:
committad av
Maneesh Gupta
förälder
21d9eb467d
incheckning
b0b21ae1cc
@@ -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);
|
||||
|
||||
Referens i nytt ärende
Block a user