[CRIU] [PATCH 05/20] mnt: Sanitize the code of reading mnt images routine

Pavel Emelyanov xemul at parallels.com
Tue Apr 22 09:36:03 PDT 2014


Signed-off-by: Pavel Emelyanov <xemul at parallels.com>
---
 mount.c |   16 ++++------------
 1 files changed, 4 insertions(+), 12 deletions(-)

diff --git a/mount.c b/mount.c
index a1c653e..5595dd0 100644
--- a/mount.c
+++ b/mount.c
@@ -1535,29 +1535,21 @@ static struct mount_info *read_mnt_ns_img(void)
 	struct mount_info *pms = NULL;
 	struct ns_id *nsid;
 
-	nsid = ns_ids;
-	while (nsid) {
-		if (nsid->nd != &mnt_ns_desc) {
-			nsid = nsid->next;
+	for (nsid = ns_ids; nsid != NULL; nsid = nsid->next) {
+		if (nsid->nd != &mnt_ns_desc)
 			continue;
-		}
 
 		if (nsid->id != root_item->ids->mnt_ns_id)
 			if (create_mnt_roots(true))
 				return NULL;
 
 		if (collect_mnt_from_image(&pms, nsid))
-			goto err;
-
-		nsid = nsid->next;
+			return NULL;
 	}
 
-	/* Here is not matter where the mount list is saved */
+	/* Here it doesn't matter where the mount list is saved */
 	mntinfo = pms;
-
 	return pms;
-err:
-	return NULL;
 }
 
 char *rst_get_mnt_root(int mnt_id)
-- 
1.7.6.5


More information about the CRIU mailing list