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

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