[PATCH 1/3] e2fsck: avoid -Wtautological-constant-out-of-range-compare warnings

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

 



From: Eric Biggers <ebiggers@xxxxxxxxxx>

Fix two compiler warnings on 32-bit platforms that have mallinfo() but
not mallinfo2().  These showed up when building e2fsprogs for armv7a or
i686 Android using the Android NDK, targeting Android API level 32 or
lower and using the autotools-based build system.

Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
---
 e2fsck/iscan.c | 3 ++-
 e2fsck/util.c  | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/e2fsck/iscan.c b/e2fsck/iscan.c
index 33c6a4cdc..1253f52ff 100644
--- a/e2fsck/iscan.c
+++ b/e2fsck/iscan.c
@@ -120,7 +120,8 @@ void print_resource_track(const char *desc,
 	} else
 #elif defined HAVE_MALLINFO
 	/* don't use mallinfo() if over 2GB used, since it returns "int" */
-	if ((char *)sbrk(0) - (char *)track->brk_start < 2LL << 30) {
+	if ((unsigned long)((char *)sbrk(0) - (char *)track->brk_start) <
+	    2UL << 30) {
 		struct mallinfo	malloc_info = mallinfo();
 
 		printf("Memory used: %lluk/%lluk (%lluk/%lluk), ",
diff --git a/e2fsck/util.c b/e2fsck/util.c
index 42740d9ef..0fe436031 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -441,7 +441,8 @@ void print_resource_track(e2fsck_t ctx, const char *desc,
 	} else
 #elif defined HAVE_MALLINFO
 	/* don't use mallinfo() if over 2GB used, since it returns "int" */
-	if ((char *)sbrk(0) - (char *)track->brk_start < 2LL << 30) {
+	if ((unsigned long)((char *)sbrk(0) - (char *)track->brk_start) <
+	    2UL << 30) {
 		struct mallinfo	malloc_info = mallinfo();
 
 		log_out(ctx, _("Memory used: %lluk/%lluk (%lluk/%lluk), "),
-- 
2.40.0




[Index of Archives]     [Reiser Filesystem Development]     [Ceph FS]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite National Park]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Device Mapper]     [Linux Media]

  Powered by Linux