]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: comparing an array to null is not useful [coverity scan]
authorKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 13:47:53 +0000 (14:47 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 31 Jan 2012 13:47:53 +0000 (14:47 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
libblkid/src/partitions/partitions.c
libblkid/src/probe.c
libblkid/src/superblocks/superblocks.c

index 80a6e8849296f14e3025f28479d0afd0b01c7470..99ec5d158e6e823a8a934cffda87258c68336cb2 100644 (file)
@@ -533,7 +533,7 @@ int blkid_is_nested_dimension(blkid_partition par,
 static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id,
                        struct blkid_chain *chn)
 {
-       const struct blkid_idmag *mag;
+       const struct blkid_idmag *mag = NULL;
        blkid_loff_t off;
        int rc = 1;             /* = nothing detected */
 
index fc7cd2c20ec471e86213f28c07226c8b1b80c7d3..d7f24b28c6a80d54b9ca12c72e18b59ef79ced8b 100644 (file)
@@ -774,7 +774,7 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
        blkid_loff_t off = 0;
 
        if (id)
-               mag = id->magics ? &id->magics[0] : NULL;
+               mag = &id->magics[0];
        if (res)
                *res = NULL;
 
@@ -799,7 +799,7 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
                mag++;
        }
 
-       if (id && id->magics && id->magics[0].magic)
+       if (id && id->magics[0].magic)
                /* magic string(s) defined, but not found */
                return 1;
 
index ea50dbc39ad844a16d9c82ab54388849aeb49b4e..e465eb154e927d6155332c292bef4d3d80b1a414 100644 (file)
@@ -357,8 +357,6 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
                if (id->minsz && id->minsz > pr->size)
                        continue;       /* the device is too small */
 
-               mag = id->magics ? &id->magics[0] : NULL;
-
                /* don't probe for RAIDs, swap or journal on CD/DVDs */
                if ((id->usage & (BLKID_USAGE_RAID | BLKID_USAGE_OTHER)) &&
                    blkid_probe_is_cdrom(pr))