From 307ff11acbe811b7834f58a5bd14dd3038c991cd Mon Sep 17 00:00:00 2001 From: Pim van Pelt Date: Fri, 28 Jan 2022 14:29:21 +0000 Subject: linux-cp: Fix coverity issue Type: fix Possible negative return in open(), do not use curr_ns_fd if it is negative. Addresses Coverity issue 248535 Signed-off-by: Pim van Pelt Change-Id: I8429ede0f1fe9fe6619e3c4dbd83adb620ea62c2 --- src/plugins/linux-cp/lcp_nl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/linux-cp/lcp_nl.c') diff --git a/src/plugins/linux-cp/lcp_nl.c b/src/plugins/linux-cp/lcp_nl.c index 8a55f4c5edd..1c0ca0d5cd5 100644 --- a/src/plugins/linux-cp/lcp_nl.c +++ b/src/plugins/linux-cp/lcp_nl.c @@ -496,7 +496,7 @@ lcp_nl_open_socket (void) nl_connect (nm->sk_route, NETLINK_ROUTE); - if (dest_ns_fd) + if (dest_ns_fd && curr_ns_fd >= 0) { setns (curr_ns_fd, CLONE_NEWNET); close (curr_ns_fd); -- cgit 1.2.3-korg