[CRIU] [RFT PATCH] compel/aarch64: fix off-by-one in compel_task_size

Mike Rapoport rppt at linux.vnet.ibm.com
Thu Aug 24 14:35:07 MSK 2017


Currently we are checking task sizes that are *less* than TASK_SIZE_MAX and
we never check with task_size == TASK_SIZE_MAX. Fix it.

Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---

I don't have an aarch64 platform handy and I'll appreciate if someone can
verify that this patch actually works...


 compel/arch/aarch64/src/lib/infect.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/compel/arch/aarch64/src/lib/infect.c b/compel/arch/aarch64/src/lib/infect.c
index 166ec23..25c60c6 100644
--- a/compel/arch/aarch64/src/lib/infect.c
+++ b/compel/arch/aarch64/src/lib/infect.c
@@ -165,9 +165,8 @@ unsigned long compel_task_size(void)
 {
 	unsigned long task_size;
 
-	for (task_size = TASK_SIZE_MIN; task_size < TASK_SIZE_MAX; task_size <<= 1)
+	for (task_size = TASK_SIZE_MIN; task_size <= TASK_SIZE_MAX; task_size <<= 1)
 		if (munmap((void *)task_size, page_size()))
 			break;
 	return task_size;
 }
-
-- 
2.7.4



More information about the CRIU mailing list