All of lore.kernel.org
 help / color / mirror / Atom feed
* build warning in e2fsprogs...
@ 2007-07-17 18:47 Eric Sandeen
  0 siblings, 0 replies; only message in thread
From: Eric Sandeen @ 2007-07-17 18:47 UTC (permalink / raw)
  To: ext4 development

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-07-17 18:52 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 18:47 build warning in e2fsprogs Eric Sandeen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.