[CRIU] [PATCH] check: don't use uninitialized variables

Andrey Vagin avagin at openvz.org
Thu Nov 26 00:25:03 PST 2015


From: Andrew Vagin <avagin at virtuozzo.com>

CID 154853 (#1 of 1): Uninitialized scalar variable (UNINIT)
7. uninit_use_in_call: Using uninitialized value c when calling write.

Reported-by: coverity
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
 cr-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cr-check.c b/cr-check.c
index c6e049b..61e6d92 100644
--- a/cr-check.c
+++ b/cr-check.c
@@ -536,7 +536,7 @@ static pid_t fork_and_ptrace_attach(int (*child_setup)(void))
 {
 	pid_t pid;
 	int sk_pair[2], sk;
-	char c;
+	char c = 0;
 
 	if (socketpair(PF_LOCAL, SOCK_SEQPACKET, 0, sk_pair)) {
 		pr_perror("socketpair");
-- 
2.4.3



More information about the CRIU mailing list