[CRIU] [PATCH 2/5] action-scripts: Check for get_service_fd error

Cyrill Gorcunov gorcunov at gmail.com
Wed May 16 11:36:34 MSK 2018


*** CID 190177:  Integer handling issues  (NEGATIVE_RETURNS)
/criu/action-scripts.c: 113 in rpc_send_fd()

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
 criu/action-scripts.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index 3cbe89ee4407..53ec3e558884 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -108,6 +108,10 @@ int rpc_send_fd(enum script_actions act, int fd)
 		return -1;
 
 	rpc_sk = get_service_fd(RPC_SK_OFF);
+	if (unlikely(rpc_sk < 0)) {
+		pr_err("Can't obtain RPC_SK_OFF service descriptor\n");
+		return -1;
+	}
 
 	pr_debug("\tRPC\n");
 	return send_criu_rpc_script(act, (char *)action, rpc_sk, fd);
-- 
2.14.3



More information about the CRIU mailing list