[CRIU] [PATCH 4/3] page-read: Don't let pr->pe remain NULL

Pavel Emelyanov xemul at virtuozzo.com
Wed Nov 30 03:06:10 PST 2016


CID 172196, issues/233.

The advance method can keep pr->pe NULL while the rest of
the code doesn't count on that.

Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>

---

diff --git a/criu/pagemap.c b/criu/pagemap.c
index 6ea2bb3..e7a45bd 100644
--- a/criu/pagemap.c
+++ b/criu/pagemap.c
@@ -166,7 +166,7 @@ static int seek_pagemap(struct page_read *pr, unsigned long vaddr,
 			bool skip_zero)
 {
 	if (!pr->pe)
-		advance(pr, skip_zero);
+		goto adv;
 
 	do {
 		unsigned long start = pr->pe->vaddr;
@@ -183,6 +183,8 @@ static int seek_pagemap(struct page_read *pr, unsigned long vaddr,
 
 		if (end <= vaddr)
 			skip_pagemap_pages(pr, end - pr->cvaddr);
+adv:
+		; /* otherwise "label at end of compound stmt" gcc error */
 	} while (advance(pr, skip_zero));
 
 	return 0;



More information about the CRIU mailing list