SWDEV-332607 - If pitch returned from hipMallocPitch is equal to pitch passed to hipMemset2D then height passed to hipMemset2D must be less than or equal to height passed to hipMallocPitch.

Change-Id: I5f9eb55cede5dff5a9e428d41fe081f043df7049
Tá an tiomantas seo le fáil i:
Jaydeep
2022-06-14 07:49:15 +00:00
tiomanta ag Jaydeepkumar Patel
tuismitheoir 2bd0cb523e
tiomantas 26d8603bf3
+9
Féach ar an gComhad
@@ -733,6 +733,10 @@ hipError_t ihipMallocPitch(void** ptr, size_t* pitch, size_t width, size_t heigh
}
size_t offset = 0; //this is ignored
amd::Memory* memObj = getMemoryObject(*ptr, offset);
memObj->getUserData().pitch_ = *pitch;
memObj->getUserData().width_ = width;
memObj->getUserData().height_ = height;
memObj->getUserData().depth_ = depth;
//saves the current device id so that it can be accessed later
memObj->getUserData().deviceId = hip::getCurrentDevice()->deviceId();
@@ -2618,6 +2622,11 @@ hipError_t ihipMemset3D_validate(hipPitchedPtr pitchedDevPtr, int value, hipExte
if (sizeBytes > memory->getSize()) {
return hipErrorInvalidValue;
}
if (pitchedDevPtr.pitch == memory->getUserData().pitch_) {
if (extent.height > memory->getUserData().height_) {
return hipErrorInvalidValue;
}
}
return hipSuccess;
}