SWDEV-298982 - hipMemPrefetchAsync should not allow more bytes than the actual size allocated
Change-Id: If8df97a79a16d39c66c508a8927ae1b4c276663e
This commit is contained in:
@@ -79,6 +79,14 @@ hipError_t hipMemPrefetchAsync(const void* dev_ptr, size_t count, int device,
|
||||
if ((dev_ptr == nullptr) || (count == 0)) {
|
||||
HIP_RETURN(hipErrorInvalidValue);
|
||||
}
|
||||
|
||||
size_t offset = 0;
|
||||
amd::Memory* memObj = getMemoryObject(dev_ptr, offset);
|
||||
// Return error if count passed is more than the actual size allocated
|
||||
if (memObj && count > (memObj->getSize() - offset)) {
|
||||
return hipErrorInvalidValue;
|
||||
}
|
||||
|
||||
amd::HostQueue* queue = nullptr;
|
||||
bool cpu_access = (device == hipCpuDeviceId) ? true : false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user