From: Eric Biggers <ebiggers@kernel.org>
To: linux-ext4@vger.kernel.org
Subject: [PATCH 1/3] e2fsck: avoid -Wtautological-constant-out-of-range-compare warnings
Date: Tue, 21 Mar 2023 20:29:43 -0700 [thread overview]
Message-ID: <20230322032945.31779-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20230322032945.31779-1-ebiggers@kernel.org>
From: Eric Biggers <ebiggers@google.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@google.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
next prev parent reply other threads:[~2023-03-22 3:30 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-22 3:29 [PATCH 0/3] e2fsprogs: test cross-compiling for Android Eric Biggers
2023-03-22 3:29 ` Eric Biggers [this message]
2023-03-22 3:29 ` [PATCH 2/3] e2freefrag: don't use linux/fsmap.h when fsmap_sizeof() is missing Eric Biggers
2023-03-22 3:29 ` [PATCH 3/3] ci.yml: test cross-compiling for Android Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230322032945.31779-2-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-ext4@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).