linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: ext4 development <linux-ext4@vger.kernel.org>
Subject: build warning in e2fsprogs...
Date: Tue, 17 Jul 2007 13:47:46 -0500	[thread overview]
Message-ID: <469D0ED2.2070101@redhat.com> (raw)

on x86_64:

badblocks.c:995: warning: comparison is always false due to limited range of data type
badblocks.c:1008: warning: comparison is always false due to limited range of data type

due to this sort of thing:

    if (*tmp || errno ||
        (last_block == ULONG_MAX && errno == ERANGE)) {
            com_err (program_name, 0, _("invalid blocks count - %s"),         
                     argv[optind]);
            exit (1);

last_block (and from_count) are both blk_t, or __u32... shouldn't 
this be UINT_MAX instead?  (though I guess at some point it *will* be 64
bits... but for now... how about the following patch...)

-Eric

-----

Fix build warning on x86_64 due to comparison of __u32 and ULONG_MAX

Signed-off-by: Eric Sandeen <sandeen@redhat.com>

Index: e2fsprogs-1.40.2/misc/badblocks.c
===================================================================
--- e2fsprogs-1.40.2.orig/misc/badblocks.c
+++ e2fsprogs-1.40.2/misc/badblocks.c
@@ -992,7 +992,7 @@ int main (int argc, char ** argv)
 		last_block = strtoul (argv[optind], &tmp, 0);
 		printf("last_block = %d (%s)\n", last_block, argv[optind]);
 		if (*tmp || errno || 
-		    (last_block == ULONG_MAX && errno == ERANGE)) {
+		    (last_block == UINT_MAX && errno == ERANGE)) {
 			com_err (program_name, 0, _("invalid blocks count - %s"),
 				 argv[optind]);
 			exit (1);
@@ -1005,7 +1005,7 @@ int main (int argc, char ** argv)
 		from_count = strtoul (argv[optind], &tmp, 0);
 		printf("from_count = %d\n", from_count);
 		if (*tmp || errno ||
-		    (from_count == ULONG_MAX && errno == ERANGE)) {
+		    (from_count == UINT_MAX && errno == ERANGE)) {
 			com_err (program_name, 0, _("invalid starting block - %s"),
 				 argv[optind]);
 			exit (1);

                 reply	other threads:[~2007-07-17 18:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=469D0ED2.2070101@redhat.com \
    --to=sandeen@redhat.com \
    --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).