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

Change-Id: I51527ce6953aee9a3ef7d821754819b6c8087939


[ROCm/clr commit: c58ba64a0b]
Этот коммит содержится в:
Satyanvesh Dittakavi
2022-01-11 15:49:48 +00:00
родитель 44f3999e05
Коммит 98fef69edd
2 изменённых файлов: 15 добавлений и 4 удалений
+8 -2
Просмотреть файл
@@ -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) {
+7 -2
Просмотреть файл
@@ -2168,13 +2168,18 @@ hipError_t hipMemcpyAtoH(void* dstHost,
}
hipError_t ihipMemcpy3D_validate(const hipMemcpy3DParms* p) {
// The struct passed to hipMemcpy3D() must specify one of srcArray or srcPtr and one of dstArray
// or dstPtr. Passing more than one non-zero source or destination will cause hipMemcpy3D() to
// Passing more than one non-zero source or destination will cause hipMemcpy3D() to
// return an error.
if (p == nullptr || ((p->srcArray != nullptr) && (p->srcPtr.ptr != nullptr)) ||
((p->dstArray != nullptr) && (p->dstPtr.ptr != nullptr))) {
return hipErrorInvalidValue;
}
// The struct passed to hipMemcpy3D() must specify one of srcArray or srcPtr and one of dstArray
// or dstPtr.
if (((p->srcArray == nullptr) && (p->srcPtr.ptr == nullptr)) ||
((p->dstArray == nullptr) && (p->dstPtr.ptr == nullptr))) {
return hipErrorInvalidValue;
}
// If the source and destination are both arrays, hipMemcpy3D() will return an error if they do
// not have the same element size.