]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
loopdev: initialize nr to avoid uninitialized use in debug [coverity: CID 490831]
authorKarel Zak <kzak@redhat.com>
Mon, 13 Jul 2026 10:41:43 +0000 (12:41 +0200)
committerKarel Zak <kzak@redhat.com>
Mon, 13 Jul 2026 10:41:43 +0000 (12:41 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/loopdev.c

index ac0b7c1f6369f53b84763499e693ad898fd4d154..c8e9c8e4d864b2e28b7dcdf23b86a744011107a1 100644 (file)
@@ -1626,6 +1626,7 @@ static int loopcxt_get_device_nr(struct loopdev_cxt *lc, int *nr)
        errno = 0;
        if (!lc || !nr)
                return rc;
+       *nr = -1;
 
        dev = loopcxt_get_device(lc);
        if (!dev)