[PATCH 6/6] libblkid: fix gcc-7 warning -Wint-in-bool-context

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

 



From: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>

BLOCK_SIZE(sb) should be unsigned so that the left shift is defined.

This was the warning:

../libblkid/src/superblocks/exfat.c: In function 'probe_exfat':
../libblkid/src/superblocks/exfat.c:40:42: warning: '<<' in boolean context, did you mean '<' ? [-Wint-in-bool-context]
 #define CLUSTER_SIZE(sb) (BLOCK_SIZE(sb) << (sb)->bpc_bits)
                          ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
../libblkid/src/superblocks/exfat.c:122:14: note: in expansion of macro 'CLUSTER_SIZE'
  if (!sb || !CLUSTER_SIZE(sb))
              ^~~~~~~~~~~~

Signed-off-by: Ruediger Meier <ruediger.meier@xxxxxxxxxxx>
---
 libblkid/src/superblocks/exfat.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libblkid/src/superblocks/exfat.c b/libblkid/src/superblocks/exfat.c
index 659e196c2..f5a22ee81 100644
--- a/libblkid/src/superblocks/exfat.c
+++ b/libblkid/src/superblocks/exfat.c
@@ -36,8 +36,8 @@ struct exfat_entry_label {
 	uint8_t name[30];
 } __attribute__((__packed__));
 
-#define BLOCK_SIZE(sb) (1 << (sb)->block_bits)
-#define CLUSTER_SIZE(sb) (BLOCK_SIZE(sb) << (sb)->bpc_bits)
+#define BLOCK_SIZE(sb) (1u << (sb)->block_bits)
+#define CLUSTER_SIZE(sb) ((BLOCK_SIZE(sb) << (sb)->bpc_bits))
 #define EXFAT_FIRST_DATA_CLUSTER 2
 #define EXFAT_LAST_DATA_CLUSTER 0xffffff6
 #define EXFAT_ENTRY_SIZE 32
-- 
2.12.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux