SWDEV-502219 - Adds validity checks for negative parameters passed
Change-Id: Ib8a531533306a27143d74b81c074de81051eb896
This commit is contained in:
committed by
Sourabh Betigeri
parent
9b7e0ad48a
commit
c460b0541b
@@ -3563,6 +3563,12 @@ hipError_t hipGraphAddBatchMemOpNode(hipGraphNode_t* phGraphNode, hipGraph_t hGr
|
||||
(numDependencies > 0 && dependencies == nullptr) || nodeParams == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
// Check nodeParams fields
|
||||
if (nodeParams->count <= 0 || nodeParams->count > 256 || nodeParams->paramArray == nullptr ||
|
||||
nodeParams->flags != 0 || nodeParams->ctx == nullptr) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
hip::GraphNode* node = new hip::hipGraphBatchMemOpNode(nodeParams);
|
||||
hipError_t status =
|
||||
ihipGraphAddNode(node, reinterpret_cast<hip::Graph*>(hGraph),
|
||||
@@ -3589,6 +3595,11 @@ hipError_t hipGraphBatchMemOpNodeSetParams(hipGraphNode_t hNode,
|
||||
if (!hip::GraphNode::isNodeValid(n) || nodeParams == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
// Check nodeParams fields
|
||||
if (nodeParams->count <= 0 || nodeParams->count > 256 || nodeParams->paramArray == nullptr ||
|
||||
nodeParams->flags != 0 || nodeParams->ctx == nullptr) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
HIP_RETURN(reinterpret_cast<hip::hipGraphBatchMemOpNode*>(n)->SetParams(nodeParams));
|
||||
}
|
||||
|
||||
@@ -3602,6 +3613,11 @@ hipError_t hipGraphExecBatchMemOpNodeSetParams(hipGraphExec_t hGraphExec,
|
||||
!hip::GraphNode::isNodeValid(n) || nodeParams == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
// Check nodeParams fields
|
||||
if (nodeParams->count <= 0 || nodeParams->count > 256 || nodeParams->paramArray == nullptr ||
|
||||
nodeParams->flags != 0 || nodeParams->ctx == nullptr) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
hip::GraphNode* clonedNode = reinterpret_cast<hip::GraphExec*>(graphExec)->GetClonedNode(n);
|
||||
if (clonedNode == nullptr) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
namespace hip {
|
||||
hipError_t ihipBatchMemOperation(hipStream_t stream, cl_command_type cmdType, unsigned int count,
|
||||
hipStreamBatchMemOpParams* paramArray, unsigned int flags) {
|
||||
if (paramArray == nullptr || flags != 0 || count > 256) {
|
||||
if (paramArray == nullptr || flags != 0 || count == 0 || count > 256) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
@@ -33,6 +33,14 @@ hipError_t ihipBatchMemOperation(hipStream_t stream, cl_command_type cmdType, un
|
||||
return hipErrorContextIsDestroyed;
|
||||
}
|
||||
|
||||
// Validate operations in paramArray
|
||||
for (unsigned int i = 0; i < count; i++) {
|
||||
// These operations are currently not supported
|
||||
if (paramArray[i].operation == hipStreamMemOpBarrier || hipStreamMemOpFlushRemoteWrites) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
}
|
||||
|
||||
hip::Stream* hip_stream = hip::getStream(stream);
|
||||
amd::Command::EventWaitList waitList;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user