[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230322032945.31779-2-ebiggers@kernel.org>
Date: Tue, 21 Mar 2023 20:29:43 -0700
From: Eric Biggers <ebiggers@...nel.org>
To: linux-ext4@...r.kernel.org
Subject: [PATCH 1/3] e2fsck: avoid -Wtautological-constant-out-of-range-compare warnings
From: Eric Biggers <ebiggers@...gle.com>
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@...gle.com>
---
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
Powered by blists - more mailing lists