dcavalca / rpms / util-linux

Forked from rpms/util-linux 2 years ago
Clone

Blame SOURCES/0113-libblkid-zfs-add-cast-to-fix-UB-cppcheck.patch

64664a
From a569050329d914ad5aa15978f2a4a3d969c7c8b1 Mon Sep 17 00:00:00 2001
64664a
From: Boris Egorov <egorov@linux.com>
64664a
Date: Tue, 19 Jan 2016 11:37:57 +0600
64664a
Subject: [PATCH 113/116] libblkid: (zfs) add cast to fix UB [cppcheck]
64664a
64664a
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 56 bits is undefined behaviour
64664a
[libblkid/src/superblocks/zfs.c:173]: (error) Shifting 32-bit value by 40 bits is undefined behaviour
64664a
64664a
Upstream: https://github.com/karelzak/util-linux/commit/18b76be61c11fd5f11fcb84aa6a946d3b03d7225
64664a
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1392661
64664a
Signed-off-by: Karel Zak <kzak@redhat.com>
64664a
---
64664a
 libblkid/src/superblocks/zfs.c | 2 +-
64664a
 1 file changed, 1 insertion(+), 1 deletion(-)
64664a
64664a
diff --git a/libblkid/src/superblocks/zfs.c b/libblkid/src/superblocks/zfs.c
64664a
index 5074495..ff12fa6 100644
64664a
--- a/libblkid/src/superblocks/zfs.c
64664a
+++ b/libblkid/src/superblocks/zfs.c
64664a
@@ -170,7 +170,7 @@ static void zfs_extract_guid_name(blkid_probe pr, loff_t offset)
64664a
 
64664a
 static int find_uberblocks(const void *label, loff_t *ub_offset, int *swap_endian)
64664a
 {
64664a
-	uint64_t swab_magic = swab64(UBERBLOCK_MAGIC);
64664a
+	uint64_t swab_magic = swab64((uint64_t)UBERBLOCK_MAGIC);
64664a
 	struct zfs_uberblock *ub;
64664a
 	int i, found = 0;
64664a
 	loff_t offset = VDEV_LABEL_UBERBLOCK;
64664a
-- 
64664a
2.9.3
64664a