]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lsfd: make sure we do not use uninitialized struct stat [coverity scan]
authorKarel Zak <kzak@redhat.com>
Mon, 29 Nov 2021 12:35:35 +0000 (13:35 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 29 Nov 2021 12:35:35 +0000 (13:35 +0100)
540             if (is_association(f, NS_MNT))
>>>     CID 374364:  Uninitialized variables  (UNINIT)
>>>     Using uninitialized value "sb.st_ino".
541                     proc->ns_mnt = sb.st_ino;

Signed-off-by: Karel Zak <kzak@redhat.com>
misc-utils/lsfd.c

index 1e05958a62527a43b24d4fd2234c390b86ff30ec..0af70785ee33f49c8a971855c383fbe55d4516e3 100644 (file)
@@ -538,7 +538,7 @@ static struct file *collect_file_symlink(struct path_cxt *pc,
        file_init_content(f);
 
        if (is_association(f, NS_MNT))
-               proc->ns_mnt = sb.st_ino;
+               proc->ns_mnt = f->stat.st_ino;
 
        else if (assoc >= 0) {
                /* file-descriptor based association */