[CRIU] [PATCH 1/2] cgroup: don't use uninitialized variables
Andrey Vagin
avagin at openvz.org
Mon Feb 29 11:40:49 PST 2016
From: Andrew Vagin <avagin at virtuozzo.com>
*** CID 158459: Uninitialized variables (UNINIT)
/criu/proc_parse.c: 2218 in parse_task_cgroup()
2212
2213 int parse_task_cgroup(int pid, struct parasite_dump_cgroup_args *args, struct list_head *retl, unsigned int *n)
2214 {
2215 FILE *f;
2216 int ret;
2217 LIST_HEAD(internal);
>>> CID 158459: Uninitialized variables (UNINIT)
>>> Declaring variable "n_internal" without initializer.
2218 unsigned int n_internal;
2219 struct cg_ctl *intern, *ext;
2220
2221 f = fopen_proc(pid, "cgroup");
2222 if (!f) {
2223 pr_perror("couldn't open task cgroup file");
** CID 158458: Memory - corruptions (NEGATIVE_RETURNS)
/criu/pie/parasite.c: 321 in get_proc_fd()
Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
---
criu/proc_parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/criu/proc_parse.c b/criu/proc_parse.c
index 8bb5271..a7e3b24 100644
--- a/criu/proc_parse.c
+++ b/criu/proc_parse.c
@@ -2215,7 +2215,7 @@ int parse_task_cgroup(int pid, struct parasite_dump_cgroup_args *args, struct li
FILE *f;
int ret;
LIST_HEAD(internal);
- unsigned int n_internal;
+ unsigned int n_internal = 0;
struct cg_ctl *intern, *ext;
f = fopen_proc(pid, "cgroup");
--
2.5.0
More information about the CRIU
mailing list