]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: (zfs) add cast to fix UB [cppcheck]
authorBoris Egorov <egorov@linux.com>
Tue, 19 Jan 2016 05:37:57 +0000 (11:37 +0600)
committerBoris Egorov <egorov@linux.com>
Tue, 19 Jan 2016 05:41:37 +0000 (11:41 +0600)
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 56 bits is undefined behaviour
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 40 bits is undefined behaviour

libblkid/src/superblocks/zfs.c

index 371fd61da54cc36819b802c4b075f637c1db3f53..2804b151d9cf9ccb400055b003d5ec6f42ef89cd 100644 (file)
@@ -170,7 +170,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
 
 static int find_uberblocks(const void *label, loff_t *ub_offset, int *swap_endian)
 {
-       uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
+       uint64_t swab_magic = swab64((uint64_t)UBERBLOCK_MAGIC);
        struct zfs_uberblock *ub;
        int i, found = 0;
        loff_t offset = VDEV_LABEL_UBERBLOCK;