From 8a0161d6bb23b220397e19f248ee5c4382a0e9e7 Mon Sep 17 00:00:00 2001 From: Felix Kuehling Date: Fri, 19 Feb 2016 17:05:13 -0500 Subject: [PATCH] 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 --- src/fmm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fmm.c b/src/fmm.c index a9be3ecd17..bd6c96978f 100644 --- a/src/fmm.c +++ b/src/fmm.c @@ -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;