[CRIU] [PATCH 3/8] lazy-pages: merge_iov_lists: fix corner case of	empty destination
    Mike Rapoport 
    rppt at linux.vnet.ibm.com
       
    Mon Apr 16 19:58:59 MSK 2018
    
    
  
Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/uffd.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff --git a/criu/uffd.c b/criu/uffd.c
index 180ac48..55de798 100644
--- a/criu/uffd.c
+++ b/criu/uffd.c
@@ -419,6 +419,14 @@ static void merge_iov_lists(struct list_head *src, struct list_head *dst)
 {
 	struct lazy_iov *iov, *p, *n;
 
+	if (list_empty(src))
+		return;
+
+	if (list_empty(dst)) {
+		iov = list_first_entry(src, struct lazy_iov, l);
+		list_move(&iov->l, dst);
+	}
+
 	list_for_each_entry_safe(iov, n, src, l) {
 		list_for_each_entry(p, dst, l) {
 			if (iov->start < p->start) {
-- 
2.7.4
    
    
More information about the CRIU
mailing list