Commit 455b96c0 authored by Pavel Tikhomirov's avatar Pavel Tikhomirov Committed by Andrei Vagin

mount: fix uninitialized use of fd on switch_ns error

close_safe can operate uninitialized fd in case of error in switch_ns,
found by Coverity Scan:

*** CID 187164:  Uninitialized variables  (UNINIT)
/criu/mount.c: 1313 in open_mountpoint()
1307     err:
1308            return 1;
1309     }
1310
1311     int open_mountpoint(struct mount_info *pm)
1312     {
>>>     CID 187164:  Uninitialized variables  (UNINIT)
>>>     Declaring variable "fd" without initializer.
1313            int fd, cwd_fd, ns_old = -1;
1314
1315            /* No overmounts and children - the entire mount is visible */
1316            if (list_empty(&pm->children) && !mnt_is_overmounted(pm))
1317                    return __open_mountpoint(pm, -1);
1318
Signed-off-by: 's avatarPavel Tikhomirov <ptikhomirov@virtuozzo.com>
Signed-off-by: 's avatarAndrei Vagin <avagin@virtuozzo.com>
parent 901d0de9
...@@ -1310,7 +1310,7 @@ err: ...@@ -1310,7 +1310,7 @@ err:
int open_mountpoint(struct mount_info *pm) int open_mountpoint(struct mount_info *pm)
{ {
int fd, cwd_fd, ns_old = -1; int fd = -1, cwd_fd, ns_old = -1;
/* No overmounts and children - the entire mount is visible */ /* No overmounts and children - the entire mount is visible */
if (list_empty(&pm->children) && !mnt_is_overmounted(pm)) if (list_empty(&pm->children) && !mnt_is_overmounted(pm))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment