SWDEV-313867 - SWDEV-314101 - Address Negative scenarios with hipGraphAddMemcpyNode and hipGraphAddMemsetNode

Change-Id: I51527ce6953aee9a3ef7d821754819b6c8087939
This commit is contained in:
Satyanvesh Dittakavi
2022-01-11 15:49:48 +00:00
parent de28c4467f
commit c58ba64a0b
2 changed files with 15 additions and 4 deletions
+8 -2
View File
@@ -129,10 +129,16 @@ hipError_t ihipGraphAddMemcpyNode1D(hipGraphNode_t* pGraphNode, hipGraph_t graph
hipError_t ihipGraphAddMemsetNode(hipGraphNode_t* pGraphNode, hipGraph_t graph,
const hipGraphNode_t* pDependencies, size_t numDependencies,
const hipMemsetParams* pMemsetParams) {
if (pGraphNode == nullptr || graph == nullptr ||
(numDependencies > 0 && pDependencies == nullptr) || pMemsetParams == nullptr) {
if (pGraphNode == nullptr || graph == nullptr || pMemsetParams == nullptr ||
(numDependencies > 0 && pDependencies == nullptr) || pMemsetParams->height == 0) {
return hipErrorInvalidValue;
}
// The element size must be 1, 2, or 4 bytes
if (pMemsetParams->elementSize != sizeof(int8_t) && pMemsetParams->elementSize != sizeof(int16_t)
&& pMemsetParams->elementSize != sizeof(int32_t)) {
return hipErrorInvalidValue;
}
hipError_t status;
status = ihipGraphMemsetParams_validate(pMemsetParams);
if (status != hipSuccess) {