[Devel] [PATCH 2/3] ns: Silence coverity warning in do_create_pid_ns_helper()
Kirill Tkhai
ktkhai at virtuozzo.com
Wed Jun 21 13:34:50 MSK 2017
------------------------------------------------------------------------------
*** CID 181219: Null pointer dereferences (NULL_RETURNS)
/criu/namespaces.c: 2690 in do_create_pid_ns_helper()
2684 struct pid *pid;
2685 pid_t child;
2686
2687 ns_reaper = *(struct pstree_item **)arg;
2688 ns = lookup_ns_by_id(ns_reaper->ids->pid_ns_id, &pid_ns_desc);
2689
>>> CID 181219: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a null pointer "ns".
2690 pid = __pstree_pid_by_virt(ns, ns->ns_pid);
2691 if (!pid) {
2692 pr_err("Can't find helper reserved pid\n");
2693 goto close_sk;
2694 }
------------------------------------------------------------------------------
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
criu/namespaces.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/criu/namespaces.c b/criu/namespaces.c
index 15de9c515..812edc209 100644
--- a/criu/namespaces.c
+++ b/criu/namespaces.c
@@ -2686,6 +2686,7 @@ static int do_create_pid_ns_helper(void *arg, int sk, pid_t unused_pid)
ns_reaper = *(struct pstree_item **)arg;
ns = lookup_ns_by_id(ns_reaper->ids->pid_ns_id, &pid_ns_desc);
+ BUG_ON(!ns);
pid = __pstree_pid_by_virt(ns, ns->ns_pid);
if (!pid) {
More information about the Devel
mailing list