]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libblkid: fix gcc-7 warning -Wint-in-bool-context
authorRuediger Meier <ruediger.meier@ga-group.nl>
Sun, 11 Jun 2017 23:59:36 +0000 (01:59 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 14 Jun 2017 09:48:22 +0000 (11:48 +0200)
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@ga-group.nl>
libblkid/src/superblocks/exfat.c

index 659e196c2dd965234ef1be126c3b2c7c05b3cf93..4bf92eac80260231a953a0c9da59cf76ea1e4667 100644 (file)
@@ -36,7 +36,7 @@ struct exfat_entry_label {
        uint8_t name[30];
 } __attribute__((__packed__));
 
-#define BLOCK_SIZE(sb) (1 << (sb)->block_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