[CRIU] [PATCH 3/3] namespaces: Silence coverity on get_service_fd()

Kirill Tkhai ktkhai at virtuozzo.com
Thu May 11 03:45:38 PDT 2017


Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 criu/cr-restore.c |    1 +
 criu/namespaces.c |    2 ++
 2 files changed, 3 insertions(+)

diff --git a/criu/cr-restore.c b/criu/cr-restore.c
index 8768b009c..230b5e470 100644
--- a/criu/cr-restore.c
+++ b/criu/cr-restore.c
@@ -406,6 +406,7 @@ static int set_next_pid(struct ns_id *pid_ns, struct pid *pid)
 	}
 
 	sk = get_service_fd(TRANSPORT_FD_OFF);
+	BUG_ON(sk < 0);
 
 	for (i = level - 1; i >= 0; i--, pid_ns = pid_ns->parent) {
 		if (i == level - 1 && last_level_pid(pid) == INIT_PID)
diff --git a/criu/namespaces.c b/criu/namespaces.c
index bb8c7dfff..cfde683b9 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2677,6 +2677,7 @@ static int do_create_pid_ns_helper(void *arg, int sk, pid_t unused_pid)
 	}
 
 	transport_fd = get_service_fd(TRANSPORT_FD_OFF);
+	BUG_ON(transport_fd < 0);
 	/*
 	 * Starting not from pid->level - 1, as it's helper has not created yet
 	 * (we're creating it in the moment), and the true pid for this level
@@ -2769,6 +2770,7 @@ static int do_destroy_pid_ns_helper(void *arg, int fd, pid_t pid)
 	}
 
 	sk = get_service_fd(TRANSPORT_FD_OFF);
+	BUG_ON(sk < 0);
 
 	for (ns = ns_ids; ns; ns = ns->next) {
 		if (ns->nd != &pid_ns_desc)



More information about the CRIU mailing list