]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/path: initialize variables for scanf [coverity scan]
authorKarel Zak <kzak@redhat.com>
Thu, 17 Mar 2022 11:22:01 +0000 (12:22 +0100)
committerKarel Zak <kzak@redhat.com>
Thu, 17 Mar 2022 11:22:01 +0000 (12:22 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
lib/path.c

index 20a3ea15d21b24e32a3165807034d941b3d56955..42b4eadf167c154d6b6156c92d778707efaa8ef2 100644 (file)
@@ -815,7 +815,7 @@ int ul_path_readf_s32(struct path_cxt *pc, int *res, const char *path, ...)
 int ul_path_read_u32(struct path_cxt *pc, unsigned int *res, const char *path)
 {
        int rc;
-       unsigned int x;
+       unsigned int x = 0;
 
        rc = ul_path_scanf(pc, path, "%u", &x);
        if (rc != 1)
@@ -839,7 +839,7 @@ int ul_path_readf_u32(struct path_cxt *pc, unsigned int *res, const char *path,
 
 int ul_path_read_majmin(struct path_cxt *pc, dev_t *res, const char *path)
 {
-       int rc, maj, min;
+       int rc, maj = 0, min = 0;
 
        rc = ul_path_scanf(pc, path, "%d:%d", &maj, &min);
        if (rc != 2)