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
This commit is contained in:
Felix Kuehling
2016-02-19 17:05:13 -05:00
والد 3f02a3cf0b
کامیت 8a0161d6bb
+1 -1
مشاهده پرونده
@@ -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;