[CRIU] [RFC PATCH 01/16] criu: page-xfer: get_remote_page: respect nr_pages parameter

Mike Rapoport rppt at linux.vnet.ibm.com
Tue Sep 27 06:42:02 PDT 2016


---
 criu/page-xfer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/criu/page-xfer.c b/criu/page-xfer.c
index 1ccab2a..5b38db4 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -889,6 +889,7 @@ out:
 int get_remote_pages(int pid, unsigned long addr, int nr_pages, void *dest)
 {
 	int ret;
+	int len = PAGE_SIZE * nr_pages;
 
 	struct page_server_iov pi;
 
@@ -908,8 +909,8 @@ int get_remote_pages(int pid, unsigned long addr, int nr_pages, void *dest)
 	if (pi.nr_pages > nr_pages)
 		return -1;
 
-	ret = recv(page_server_sk, dest, PAGE_SIZE, MSG_WAITALL);
-	if (ret != PAGE_SIZE)
+	ret = recv(page_server_sk, dest, len, MSG_WAITALL);
+	if (ret != len)
 		return -1;
 
 	return 1;
-- 
1.9.1



More information about the CRIU mailing list