[PATCH 53/72] libmultipath, kpartx: byteorder: always use unsigned types

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Martin Wilck <mwilck@xxxxxxxx>

The swapped results are unsigned, so the non-swapped ones should
be unsigned, too.

Signed-off-by: Martin Wilck <mwilck@xxxxxxxx>
---
 kpartx/gpt.c             |  6 +++---
 libmultipath/byteorder.h | 12 ++++++------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/kpartx/gpt.c b/kpartx/gpt.c
index 4f88d486..aa2a440c 100644
--- a/kpartx/gpt.c
+++ b/kpartx/gpt.c
@@ -40,9 +40,9 @@
 #include "kpartx.h"
 
 #if BYTE_ORDER == LITTLE_ENDIAN
-#  define __le16_to_cpu(x) (x)
-#  define __le32_to_cpu(x) (x)
-#  define __le64_to_cpu(x) (x)
+#  define __le16_to_cpu(x) (uint16_t)(x)
+#  define __le32_to_cpu(x) (uint32_t)(x)
+#  define __le64_to_cpu(x) (uint64_t)(x)
 #  define __cpu_to_le32(x) (x)
 #elif BYTE_ORDER == BIG_ENDIAN
 #  define __le16_to_cpu(x) bswap_16(x)
diff --git a/libmultipath/byteorder.h b/libmultipath/byteorder.h
index 5c771467..0a862447 100644
--- a/libmultipath/byteorder.h
+++ b/libmultipath/byteorder.h
@@ -9,19 +9,19 @@
 #endif
 
 #if BYTE_ORDER == LITTLE_ENDIAN
-#  define le16_to_cpu(x) (x)
+#  define le16_to_cpu(x) (uint16_t)(x)
 #  define be16_to_cpu(x) bswap_16(x)
-#  define le32_to_cpu(x) (x)
-#  define le64_to_cpu(x) (x)
+#  define le32_to_cpu(x) (uint32_t)(x)
+#  define le64_to_cpu(x) (uint64_t)(x)
 #  define be32_to_cpu(x) bswap_32(x)
 #  define be64_to_cpu(x) bswap_64(x)
 #elif BYTE_ORDER == BIG_ENDIAN
 #  define le16_to_cpu(x) bswap_16(x)
-#  define be16_to_cpu(x) (x)
+#  define be16_to_cpu(x) (uint16_t)(x)
 #  define le32_to_cpu(x) bswap_32(x)
 #  define le64_to_cpu(x) bswap_64(x)
-#  define be32_to_cpu(x) (x)
-#  define be64_to_cpu(x) (x)
+#  define be32_to_cpu(x) (uint32_t)(x)
+#  define be64_to_cpu(x) (uint64_t)(x)
 #else
 #  error unsupported
 #endif
-- 
2.23.0


--
dm-devel mailing list
dm-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/dm-devel



[Index of Archives]     [DM Crypt]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Packaging]     [Fedora SELinux]     [Yosemite Discussion]     [KDE Users]     [Fedora Docs]

  Powered by Linux