]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: [superblocks] fix compiler warnings [-Wunused-parameter -Wsign-compare]
authorKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:28:04 +0000 (13:28 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 2 Aug 2011 11:28:04 +0000 (13:28 +0200)
Signed-off-by: Karel Zak <kzak@redhat.com>
22 files changed:
libblkid/src/superblocks/adaptec_raid.c
libblkid/src/superblocks/befs.c
libblkid/src/superblocks/ddf_raid.c
libblkid/src/superblocks/drbd.c
libblkid/src/superblocks/ext.c
libblkid/src/superblocks/highpoint_raid.c
libblkid/src/superblocks/iso9660.c
libblkid/src/superblocks/isw_raid.c
libblkid/src/superblocks/jfs.c
libblkid/src/superblocks/jmicron_raid.c
libblkid/src/superblocks/linux_raid.c
libblkid/src/superblocks/lsi_raid.c
libblkid/src/superblocks/nvidia_raid.c
libblkid/src/superblocks/promise_raid.c
libblkid/src/superblocks/silicon_raid.c
libblkid/src/superblocks/superblocks.c
libblkid/src/superblocks/sysv.c
libblkid/src/superblocks/udf.c
libblkid/src/superblocks/ufs.c
libblkid/src/superblocks/vfat.c
libblkid/src/superblocks/via_raid.c
libblkid/src/superblocks/zfs.c

index 570e75e9f786ce89f30b5e76e6d4efb3d02ae4e3..02e900df0dd494544dd4a20393a622852993e949 100644 (file)
@@ -73,7 +73,8 @@ struct adaptec_metadata {
 #define AD_SIGNATURE   0x4450544D      /* "DPTM" */
 #define AD_MAGIC       0x37FC4D1E
 
-static int probe_adraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_adraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct adaptec_metadata *ad;
index c78dc208eca8c1567d5814576b3cdaf656899298..62414ec61f677a318a638deeaade416eda49ab00 100644 (file)
@@ -158,9 +158,9 @@ unsigned char *get_tree_node(blkid_probe pr, const struct befs_super_block *bs,
                                const struct data_stream *ds,
                                int64_t start, uint32_t length, int fs_le)
 {
-       if (start < FS64_TO_CPU(ds->max_direct_range, fs_le)) {
+       if (start < (int64_t) FS64_TO_CPU(ds->max_direct_range, fs_le)) {
                int64_t br_len;
-               int i;
+               size_t i;
 
                for (i = 0; i < NUM_DIRECT_BLOCKS; i++) {
                        br_len = (int64_t) FS16_TO_CPU(ds->direct[i].len, fs_le)
@@ -172,7 +172,7 @@ unsigned char *get_tree_node(blkid_probe pr, const struct befs_super_block *bs,
                        else
                                start -= br_len;
                }
-       } else if (start < FS64_TO_CPU(ds->max_indirect_range, fs_le)) {
+       } else if (start < (int64_t) FS64_TO_CPU(ds->max_indirect_range, fs_le)) {
                struct block_run *br;
                int64_t max_br, br_len, i;
 
@@ -195,11 +195,11 @@ unsigned char *get_tree_node(blkid_probe pr, const struct befs_super_block *bs,
                        else
                                start -= br_len;
                }
-       } else if (start < FS64_TO_CPU(ds->max_double_indirect_range, fs_le)) {
+       } else if (start < (int64_t) FS64_TO_CPU(ds->max_double_indirect_range, fs_le)) {
                struct block_run *br;
                int64_t di_br_size, br_per_di_br, di_index, i_index;
 
-               start -= FS64_TO_CPU(ds->max_indirect_range, fs_le);
+               start -= (int64_t) FS64_TO_CPU(ds->max_indirect_range, fs_le);
                di_br_size = (int64_t) FS16_TO_CPU(ds->double_indirect.len,
                                fs_le) << FS32_TO_CPU(bs->block_shift, fs_le);
                br_per_di_br = di_br_size / sizeof(struct block_run);
@@ -259,7 +259,7 @@ int64_t get_key_value(blkid_probe pr, const struct befs_super_block *bs,
        if (!bh)
                return -1;
 
-       if (FS32_TO_CPU(bh->magic, fs_le) != BPLUSTREE_MAGIC)
+       if ((int32_t) FS32_TO_CPU(bh->magic, fs_le) != BPLUSTREE_MAGIC)
                return -1;
 
        node_pointer = FS64_TO_CPU(bh->root_node_pointer, fs_le);
@@ -285,7 +285,7 @@ int64_t get_key_value(blkid_probe pr, const struct befs_super_block *bs,
                cmp = compare_keys(bn->name, keylengths, last, key, strlen(key),
                                                                        fs_le);
                if (cmp == 0) {
-                       if (FS64_TO_CPU(bn->overflow_link, fs_le)
+                       if ((int64_t) FS64_TO_CPU(bn->overflow_link, fs_le)
                                                        == BPLUSTREE_NULL)
                                return FS64_TO_CPU(values[last], fs_le);
                        else
@@ -299,7 +299,7 @@ int64_t get_key_value(blkid_probe pr, const struct befs_super_block *bs,
                                cmp = compare_keys(bn->name, keylengths, mid,
                                                key, strlen(key), fs_le);
                                if (cmp == 0) {
-                                       if (FS64_TO_CPU(bn->overflow_link,
+                                       if ((int64_t) FS64_TO_CPU(bn->overflow_link,
                                                fs_le) == BPLUSTREE_NULL)
                                                return FS64_TO_CPU(values[mid],
                                                                        fs_le);
@@ -316,7 +316,8 @@ int64_t get_key_value(blkid_probe pr, const struct befs_super_block *bs,
                        else
                                node_pointer = FS64_TO_CPU(values[mid], fs_le);
                }
-       } while (FS64_TO_CPU(bn->overflow_link, fs_le) != BPLUSTREE_NULL);
+       } while ((int64_t) FS64_TO_CPU(bn->overflow_link, fs_le)
+                                               != BPLUSTREE_NULL);
        return 0;
 }
 
@@ -355,8 +356,8 @@ int get_uuid(blkid_probe pr, const struct befs_super_block *bs,
                                + FS16_TO_CPU(sd->data_size, fs_le) + 1);
 
        } while ((intptr_t) sd < (intptr_t) bi
-                                       + FS32_TO_CPU(bi->inode_size, fs_le)
-                                       - sizeof(struct small_data));
+                               + (int32_t) FS32_TO_CPU(bi->inode_size, fs_le)
+                               - (int32_t) sizeof(struct small_data));
        if (*uuid == 0
                && (FS32_TO_CPU(bi->attributes.allocation_group, fs_le) != 0
                        || FS16_TO_CPU(bi->attributes.start, fs_le) != 0
index c0ba3351721a4fc1ed7bf1462affba303bfe4bea..24df421d14ec7ba9b6a180f29aeab63728f4cfe4 100644 (file)
@@ -71,10 +71,11 @@ struct ddf_header {
        uint8_t         pad4[256];      /* 0xff */
 } __attribute__((packed));
 
-static int probe_ddf(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ddf(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        int hdrs[] = { 1, 257 };
-       int i;
+       size_t i;
        struct ddf_header *ddf = NULL;
        char version[DDF_REV_LENGTH + 1];
        uint64_t off, lba;
index 3490948de3e712fbe128e250c82eab73b5b89016..1e404069bdaee737d99f94dd04ffb98adc8ef3bb 100644 (file)
@@ -64,7 +64,8 @@ struct md_on_disk_08 {
 };
 
 
-static int probe_drbd(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_drbd(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct md_on_disk_08 *md;
        off_t off;
index 6dfe528318d8a3e855a3fb4fe6a195cda384c19c..4066347cd5f850ab4c342762df44bd9bf69ca9c8 100644 (file)
@@ -311,7 +311,8 @@ static void ext_get_info(blkid_probe pr, int ver, struct ext2_super_block *es)
 }
 
 
-static int probe_jbd(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_jbd(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct ext2_super_block *es;
        uint32_t fi;
@@ -326,7 +327,8 @@ static int probe_jbd(blkid_probe pr, const struct blkid_idmag *mag)
        return 0;
 }
 
-static int probe_ext2(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ext2(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct ext2_super_block *es;
        uint32_t fc, frc, fi;
@@ -357,7 +359,8 @@ static int probe_ext2(blkid_probe pr, const struct blkid_idmag *mag)
        return 0;
 }
 
-static int probe_ext3(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ext3(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct ext2_super_block *es;
        uint32_t fc, frc, fi;
@@ -380,7 +383,8 @@ static int probe_ext3(blkid_probe pr, const struct blkid_idmag *mag)
 }
 
 
-static int probe_ext4dev(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ext4dev(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct ext2_super_block *es;
        uint32_t fc, frc, fi;
@@ -425,7 +429,8 @@ force_ext4dev:
        return 0;
 }
 
-static int probe_ext4(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ext4(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct ext2_super_block *es;
        uint32_t fc, frc, fi;
index 25e3114b3fbbeb5c76c6946b2a2ac51fc2f38493..0b41344ae3b2956d248f5f141d64173ff839f2d7 100644 (file)
@@ -22,7 +22,8 @@ struct hpt45x_metadata {
 #define HPT45X_MAGIC_OK                        0x5a7816f3
 #define HPT45X_MAGIC_BAD               0x5a7816fd
 
-static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_highpoint45x(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct hpt45x_metadata *hpt;
        uint64_t off;
@@ -49,7 +50,8 @@ static int probe_highpoint45x(blkid_probe pr, const struct blkid_idmag *mag)
        return 0;
 }
 
-static int probe_highpoint37x(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_highpoint37x(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        if (!S_ISREG(pr->mode) && !blkid_probe_is_wholedisk(pr))
                return -1;
index 9f3ce2e601544dcf3b15e3e939b2d9da9968ac0f..36bf07713400f13435836f80074bc760e102f628 100644 (file)
@@ -54,7 +54,7 @@ struct high_sierra_volume_descriptor {
 static int ascii_eq_utf16be(unsigned char *ascii,
                        unsigned char *utf16, size_t len)
 {
-       int a, u;
+       size_t a, u;
 
        for (a = 0, u = 0; u < len; a++, u += 2) {
                if (utf16[u] != 0x0 || ascii[a] != utf16[u + 1])
index ac6251d7c3bd39cac0f91eeb7beb62fd054e7419..755c1b65254a54678d5bba0719fab7aac01d734d 100644 (file)
@@ -26,7 +26,8 @@ struct isw_metadata {
 #define ISW_SIGNATURE          "Intel Raid ISM Cfg Sig. "
 
 
-static int probe_iswraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_iswraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct isw_metadata *isw;
index 9a49c67469c49983034680548b7351057b23ef15..78c018c151aad4153a114400eb2574a2a6354c12 100644 (file)
@@ -41,9 +41,9 @@ static int probe_jfs(blkid_probe pr, const struct blkid_idmag *mag)
        js = blkid_probe_get_sb(pr, mag, struct jfs_super_block);
        if (!js)
                return -1;
-       if (le32_to_cpu(js->js_bsize) != (1 << le16_to_cpu(js->js_l2bsize)))
+       if (le32_to_cpu(js->js_bsize) != (1U << le16_to_cpu(js->js_l2bsize)))
                return 1;
-       if (le32_to_cpu(js->js_pbsize) != (1 << le16_to_cpu(js->js_l2pbsize)))
+       if (le32_to_cpu(js->js_pbsize) != (1U << le16_to_cpu(js->js_l2pbsize)))
                return 1;
        if ((le16_to_cpu(js->js_l2bsize) - le16_to_cpu(js->js_l2pbsize)) !=
            le16_to_cpu(js->js_l2bfactor))
index d35b17f896aa1f9b0c544cc0d73ec82f6848ea4e..c7080780f422ee6fe6e0ae65fb0dc779a88949af 100644 (file)
@@ -25,7 +25,8 @@ struct jm_metadata {
 
 #define JM_SIGNATURE           "JM"
 
-static int probe_jmraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_jmraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct jm_metadata *jm;
index e74f57de9cde1cee8312ab969acad93007e90d8a..609d24bf752f837b8226a746af9aea8144c9e0bd 100644 (file)
@@ -148,11 +148,11 @@ static int probe_raid0(blkid_probe pr, blkid_loff_t off)
 
        size <<= 10;    /* convert KiB to bytes */
 
-       if (pr->size < size + MD_RESERVED_BYTES)
+       if (pr->size < 0 || (uint64_t) pr->size < size + MD_RESERVED_BYTES)
                /* device is too small */
                return 1;
 
-       if (off < size)
+       if (off < 0 || (uint64_t) off < size)
                /* no space before superblock */
                return 1;
 
@@ -194,9 +194,9 @@ static int probe_raid1(blkid_probe pr, off_t off)
                return -1;
        if (le32_to_cpu(mdp1->magic) != MD_SB_MAGIC)
                return -1;
-       if (le32_to_cpu(mdp1->major_version) != 1)
+       if (le32_to_cpu(mdp1->major_version) != 1U)
                return -1;
-       if (le64_to_cpu(mdp1->super_offset) != off >> 9)
+       if (le64_to_cpu(mdp1->super_offset) != (uint64_t) off >> 9)
                return -1;
        if (blkid_probe_set_uuid(pr, (unsigned char *) mdp1->set_uuid) != 0)
                return -1;
@@ -212,7 +212,8 @@ static int probe_raid1(blkid_probe pr, off_t off)
        return 0;
 }
 
-int probe_raid(blkid_probe pr, const struct blkid_idmag *mag)
+int probe_raid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        const char *ver = NULL;
 
index 5217a0093c91a7ead90b85dbad9e240d108a3e70..56721dd71950604fa322de8ccef3c30bdf4a6c98 100644 (file)
@@ -23,7 +23,8 @@ struct lsi_metadata {
 
 #define LSI_SIGNATURE          "$XIDE$"
 
-static int probe_lsiraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_lsiraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct lsi_metadata *lsi;
index c3db949a8a9b50c40ba44f79c367d05c6d822d49..dd86cdcc6a1cd1a60e60f43f7b36531b608ef680 100644 (file)
@@ -25,7 +25,8 @@ struct nv_metadata {
 
 #define NVIDIA_SIGNATURE               "NVIDIA"
 
-static int probe_nvraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_nvraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct nv_metadata *nv;
index 0e91d3c257506d4246246b2024df3ff509781515..221146dbce543d6646d81ebfb9961eb808f8f9b4 100644 (file)
@@ -24,7 +24,8 @@ struct promise_metadata {
 #define PDC_CONFIG_OFF         0x1200
 #define PDC_SIGNATURE          "Promise Technology, Inc."
 
-static int probe_pdcraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_pdcraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        unsigned int i;
        static unsigned int sectors[] = {
index b72b72760bae158578685fc9c64444cf3253cd56..fef58010cbd76c50924c976191fe3769e13cc2c0 100644 (file)
@@ -41,7 +41,8 @@ struct silicon_metadata {
 #define SILICON_MAGIC          0x2F000000
 
 
-static int probe_silraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_silraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct silicon_metadata *sil;
index 9b618b28f10ea595b498bc25fce9c2c0dd925d07..8a0edaa7c46a4986a96e410b3cc9ad22e31405dd 100644 (file)
@@ -251,7 +251,7 @@ int blkid_probe_filter_superblocks_usage(blkid_probe pr, int flag, int usage)
 {
        unsigned long *fltr;
        struct blkid_chain *chn;
-       int i;
+       size_t i;
 
        if (!pr)
                return -1;
@@ -283,7 +283,7 @@ int blkid_probe_filter_superblocks_usage(blkid_probe pr, int flag, int usage)
  */
 int blkid_known_fstype(const char *fstype)
 {
-       int i;
+       size_t i;
 
        if (!fstype)
                return 0;
@@ -306,7 +306,7 @@ int blkid_known_fstype(const char *fstype)
  */
 int blkid_superblocks_get_name(size_t idx, const char **name, int *usage)
 {
-       if (idx >= 0 && idx < ARRAY_SIZE(idinfos)) {
+       if (idx < ARRAY_SIZE(idinfos)) {
                if (name)
                        *name = idinfos[idx]->name;
                if (usage)
@@ -321,7 +321,7 @@ int blkid_superblocks_get_name(size_t idx, const char **name, int *usage)
  */
 static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
 {
-       int i = 0;
+       size_t i;
 
        if (!pr || chn->idx < -1)
                return -1;
@@ -337,7 +337,7 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
                 * is 1 byte */
                goto nothing;
 
-       i = chn->idx + 1;
+       i = chn->idx < 0 ? 0 : chn->idx + 1U;
 
        for ( ; i < ARRAY_SIZE(idinfos); i++) {
                const struct blkid_idinfo *id;
@@ -366,7 +366,7 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
                if ((id->usage & BLKID_USAGE_RAID) && blkid_probe_is_tiny(pr))
                        continue;
 
-               DBG(DEBUG_LOWPROBE, printf("[%d] %s:\n", i, id->name));
+               DBG(DEBUG_LOWPROBE, printf("[%zd] %s:\n", i, id->name));
 
                if (blkid_probe_get_idmag(pr, id, &off, &mag))
                        continue;
@@ -593,7 +593,7 @@ int blkid_probe_set_utf8label(blkid_probe pr, unsigned char *label,
 /* like uuid_is_null() from libuuid, but works with arbitrary size of UUID */
 static int uuid_is_empty(const unsigned char *buf, size_t len)
 {
-       int i;
+       size_t i;
 
        for (i = 0; i < len; i++)
                if (buf[i])
@@ -626,7 +626,7 @@ int blkid_probe_sprintf_uuid(blkid_probe pr, unsigned char *uuid,
 
        /* convert to lower case (..be paranoid) */
        if (!rc) {
-               int i;
+               size_t i;
                struct blkid_prval *v = __blkid_probe_get_value(pr,
                                                blkid_probe_numof_values(pr));
                if (v) {
index 00c8c978b5c2edd6e0c373472bc46f5277edaf76..80b0cc542ba9c9ef0443a8faa0f17ed2b268f806 100644 (file)
@@ -90,11 +90,12 @@ static int probe_xenix(blkid_probe pr, const struct blkid_idmag *mag)
 /* Note that we don't probe for Coherent FS, this FS does not have
  * magic string. (It requires to probe fname/fpack field..)
  */
-static int probe_sysv(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_sysv(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct sysv_super_block *sb;
        int blocks[] = {0, 9, 15, 18};
-       int i;
+       size_t i;
 
        for (i = 0; i < ARRAY_SIZE(blocks); i++) {
                int off = blocks[i] * SYSV_BLOCK_SIZE + SYSV_BLOCK_SIZE/2;
index 766d6980fa55fa4f0d1f0b955737091ea43ea596..a5afc5c587649ed5beadfc26d718844461bec9c1 100644 (file)
@@ -57,7 +57,8 @@ struct volume_structure_descriptor {
 
 #define UDF_VSD_OFFSET                 0x8000LL
 
-static int probe_udf(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_udf(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        struct volume_descriptor *vd;
        struct volume_structure_descriptor *vsd;
index 05bed1451373f6dc1cc4dcc899f58752c95d15a3..3ace715e935086dd4d2b2a3ca328000d8bccf3eb 100644 (file)
@@ -163,20 +163,21 @@ struct ufs_super_block {
 #define UFS_MAGIC_SEC                  0x00612195
 #define UFS_MAGIC_4GB                  0x05231994
 
-static int probe_ufs(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_ufs(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        int offsets[] = { 0, 8, 64, 256 };
-       int mags[] = {
+       uint32_t mags[] = {
                UFS2_MAGIC, UFS_MAGIC, UFS_MAGIC_FEA, UFS_MAGIC_LFN,
                UFS_MAGIC_SEC, UFS_MAGIC_4GB
        };
-       int i;
+       size_t i;
        uint32_t magic;
        struct ufs_super_block *ufs;
 
        for (i = 0; i < ARRAY_SIZE(offsets); i++) {
                uint32_t magLE, magBE;
-               int y;
+               size_t y;
 
                ufs = (struct ufs_super_block *)
                                blkid_probe_get_buffer(pr,
index bf474630d72b94758170d20755606d0acb66b7b1..13d5769532eafd5b963af273f54a9d289733c653 100644 (file)
@@ -121,7 +121,7 @@ static unsigned char *search_fat_label(blkid_probe pr,
                                uint64_t offset, uint32_t entries)
 {
        struct vfat_dir_entry *ent, *dir = NULL;
-       int i;
+       uint32_t i;
 
        DBG(DEBUG_LOWPROBE,
                printf("\tlook for label in root-dir "
index 2013138015a7e272a78a0b3caebf12e7ec310fb2..eba7e4bf2f4caee05e56d898fb6959fb0820f32f 100644 (file)
@@ -45,7 +45,8 @@ static uint8_t via_checksum(struct via_metadata *v)
        return cs == v->checksum;
 }
 
-static int probe_viaraid(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_viaraid(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t off;
        struct via_metadata *v;
index af5264d46207a136482a0ea66918fcc0332f8478..b96c5df45ef9ccf0a1a2a08cf44ea83d7ab296fc 100644 (file)
@@ -70,7 +70,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
 {
        struct nvlist *nvl;
        struct nvpair *nvp;
-       int left = 4096;
+       size_t left = 4096;
        int found = 0;
 
        offset = (offset & ~(VDEV_LABEL_SIZE - 1)) + VDEV_LABEL_NVPAIR;
@@ -94,7 +94,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
                nvp->nvp_namelen = be32_to_cpu(nvp->nvp_namelen);
                avail = nvp->nvp_size - nvp->nvp_namelen - sizeof(*nvp);
 
-               nvdebug("left %u, nvp_size %u\n", left, nvp->nvp_size);
+               nvdebug("left %zd nvp_size %u\n", left, nvp->nvp_size);
                if (left < nvp->nvp_size || avail < 0)
                        break;
 
@@ -148,7 +148,10 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
                                                         "%"PRIu64, nvu_value);
                        found++;
                }
-               left -= nvp->nvp_size;
+               if (left > nvp->nvp_size)
+                       left -= nvp->nvp_size;
+               else
+                       left = 0;
                nvp = (struct nvpair *)((char *)nvp + nvp->nvp_size);
        }
 }
@@ -159,7 +162,8 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
 /* ZFS has 128x1kB host-endian root blocks, stored in 2 areas at the start
  * of the disk, and 2 areas at the end of the disk.  Check only some of them...
  * #4 (@ 132kB) is the first one written on a new filesystem. */
-static int probe_zfs(blkid_probe pr, const struct blkid_idmag *mag)
+static int probe_zfs(blkid_probe pr,
+               const struct blkid_idmag *mag __attribute__((__unused__)))
 {
        uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
        struct zfs_uberblock *ub;