build warning in e2fsprogs...

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

 



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@xxxxxxxxxx>

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);


-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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