[CRIU] [PATCH] mnt_tree_for_each_reverse(): init a variable

Kir Kolyshkin kir at openvz.org
Thu Dec 19 13:18:45 PST 2013


A warning catched by clang:

> mount.c:869:71: error: variable 'progress' is uninitialized when used here
>       [-Werror,-Wuninitialized]
>   ...prev, MNT_WALK_NONE, fn, (struct list_head *) NULL, progress);
>                                                          ^~~~~~~~
> mount.c:802:4: note: expanded from macro 'MNT_TREE_WALK'
>                         _prgs++;
> \
>                         ^
> mount.c:867:14: note: initialize the variable 'progress' to silence this
> warning
>         int progress;
>                     ^
>                      = 0
> 1 error generated.

Signed-off-by: Kir Kolyshkin <kir at openvz.org>
---
 mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index f943cf7..dcc73c6 100644
--- a/mount.c
+++ b/mount.c
@@ -864,7 +864,7 @@ again:
 static int mnt_tree_for_each_reverse(struct mount_info *m,
 		int (*fn)(struct mount_info *))
 {
-	int progress;
+	int progress = 0;
 
 	MNT_TREE_WALK(m, prev, MNT_WALK_NONE, fn, (struct list_head *) NULL, progress);
 
-- 
1.8.1.4



More information about the CRIU mailing list