[CRIU] [PATCH 1/4] action-scripts: check a return code of get_service_fd
Andrei Vagin
avagin at virtuozzo.com
Wed May 16 01:55:56 MSK 2018
>>> CID 190177: Integer handling issues (NEGATIVE_RETURNS)
>>> rpc_sk is passed to a parameter that cannot be negative.
Signed-off-by: Andrei Vagin <avagin at virtuozzo.com>
---
criu/action-scripts.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/criu/action-scripts.c b/criu/action-scripts.c
index 3cbe89ee4..7b78a1360 100644
--- a/criu/action-scripts.c
+++ b/criu/action-scripts.c
@@ -108,6 +108,8 @@ int rpc_send_fd(enum script_actions act, int fd)
return -1;
rpc_sk = get_service_fd(RPC_SK_OFF);
+ if (rpc_sk < 0)
+ return -1;
pr_debug("\tRPC\n");
return send_criu_rpc_script(act, (char *)action, rpc_sk, fd);
@@ -128,6 +130,10 @@ int run_scripts(enum script_actions act)
pr_debug("\tRPC\n");
rpc_sk = get_service_fd(RPC_SK_OFF);
+ if (rpc_sk < 0) {
+ ret = -1;
+ goto out;
+ }
ret = send_criu_rpc_script(act, (char *)action, rpc_sk, -1);
goto out;
}
--
2.14.3
More information about the CRIU
mailing list