Use aligned size for looking up userptr object after allocation

The alignment performed in vm_find_object_by_address isn't sufficient
because it doesn't take into account the offset from the start of the
page.

This fixes a bug where certain unaligned userpointers and sizes fail
to register correctly.

Change-Id: I17872e264467a619f5e1bedb7e1ed3d994a856bf


[ROCm/ROCR-Runtime commit: 8a0161d6bb]
This commit is contained in:
Felix Kuehling
2016-02-19 17:05:13 -05:00
والد 18953cfa9a
کامیت 8ae4e547bc
@@ -1832,7 +1832,7 @@ static HSAKMT_STATUS fmm_register_user_memory(void *addr, HSAuint64 size, vm_obj
/* Find the object and set its userptr address */
pthread_mutex_lock(&aperture->fmm_mutex);
obj = vm_find_object_by_address(aperture, svm_addr, size);
obj = vm_find_object_by_address(aperture, svm_addr, aligned_size);
if (obj == NULL) {
pthread_mutex_unlock(&aperture->fmm_mutex);
return HSAKMT_STATUS_ERROR;