[CRIU] [PATCH v3 11/19] criu: page-xfer: get_remote_page: respect nr_pages parameter

Mike Rapoport rppt at linux.vnet.ibm.com
Tue Nov 15 08:57:20 PST 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 f870f2b..27800c4 100644
--- a/criu/page-xfer.c
+++ b/criu/page-xfer.c
@@ -890,6 +890,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;
 
@@ -909,8 +910,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