All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] quota: integer constant is too large for ‘long’ type in
@ 2009-12-15 13:27 Jerry Leo
  2009-12-15 15:24 ` Joe Perches
  2009-12-15 21:28 ` Jan Kara
  0 siblings, 2 replies; 4+ messages in thread
From: Jerry Leo @ 2009-12-15 13:27 UTC (permalink / raw)
  To: jack; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1240 bytes --]

Hi, Jan Kara,

the Patch is for this:

CC      fs/quota/quota_v2.o
fs/quota/quota_v2.c: In function ‘v2_read_file_info’:
fs/quota/quota_v2.c:123: warning: integer constant is too large for ‘long’ type
fs/quota/quota_v2.c:124: warning: integer constant is too large for ‘long’ type


Can this patch be fixed?


diff --git a/linux-2.6/fs/quota/quota_v2.c.orig b/linux-2.6/fs/quota/quota_v2.c
index 3dfc23e..be9ea1e 100644
--- a/linux-2.6/fs/quota/quota_v2.c.orig
+++ b/linux-2.6/fs/quota/quota_v2.c
@@ -120,8 +120,8 @@ static int v2_read_file_info(struct super_block
*sb, int type)
                info->dqi_maxilimit = 0xffffffff;
        } else {
                /* used space is stored as unsigned 64-bit value */
-               info->dqi_maxblimit = 0xffffffffffffffff;       /* 2^64-1 */
-               info->dqi_maxilimit = 0xffffffffffffffff;
+               info->dqi_maxblimit = 0xFFFFFFFFFFFFFFFFLL;     /* 2^64-1 */
+               info->dqi_maxilimit = 0xFFFFFFFFFFFFFFFFLL;
        }
        info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
        info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);


Best Regards!

                                                                   JerryLeo

[-- Attachment #2: patch --]
[-- Type: application/octet-stream, Size: 691 bytes --]

diff --git a/linux-2.6/fs/quota/quota_v2.c.orig b/linux-2.6/fs/quota/quota_v2.c
index 3dfc23e..be9ea1e 100644
--- a/linux-2.6/fs/quota/quota_v2.c.orig
+++ b/linux-2.6/fs/quota/quota_v2.c
@@ -120,8 +120,8 @@ static int v2_read_file_info(struct super_block *sb, int type)
 		info->dqi_maxilimit = 0xffffffff;
 	} else {
 		/* used space is stored as unsigned 64-bit value */
-		info->dqi_maxblimit = 0xffffffffffffffff;	/* 2^64-1 */
-		info->dqi_maxilimit = 0xffffffffffffffff;
+		info->dqi_maxblimit = 0xFFFFFFFFFFFFFFFFLL;	/* 2^64-1 */
+		info->dqi_maxilimit = 0xFFFFFFFFFFFFFFFFLL;
 	}
 	info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
 	info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] quota: integer constant is too large for ‘long’ type in
  2009-12-15 13:27 [PATCH] quota: integer constant is too large for ‘long’ type in Jerry Leo
@ 2009-12-15 15:24 ` Joe Perches
  2009-12-15 21:30   ` Jan Kara
  2009-12-15 21:28 ` Jan Kara
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2009-12-15 15:24 UTC (permalink / raw)
  To: Jerry Leo; +Cc: jack, linux-kernel

On Tue, 2009-12-15 at 21:27 +0800, Jerry Leo wrote:
> -               info->dqi_maxblimit = 0xffffffffffffffff;       /* 2^64-1 */
> -               info->dqi_maxilimit = 0xffffffffffffffff;
> +               info->dqi_maxblimit = 0xFFFFFFFFFFFFFFFFLL;     /* 2^64-1 */
> +               info->dqi_maxilimit = 0xFFFFFFFFFFFFFFFFLL;

ULLONG_MAX?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] quota: integer constant is too large for ‘long’ type in
  2009-12-15 13:27 [PATCH] quota: integer constant is too large for ‘long’ type in Jerry Leo
  2009-12-15 15:24 ` Joe Perches
@ 2009-12-15 21:28 ` Jan Kara
  1 sibling, 0 replies; 4+ messages in thread
From: Jan Kara @ 2009-12-15 21:28 UTC (permalink / raw)
  To: Jerry Leo; +Cc: linux-kernel

On Tue 15-12-09 21:27:50, Jerry Leo wrote:
> Hi, Jan Kara,
> 
> the Patch is for this:
> 
> CC      fs/quota/quota_v2.o
> fs/quota/quota_v2.c: In function ‘v2_read_file_info’:
> fs/quota/quota_v2.c:123: warning: integer constant is too large for ‘long’ type
> fs/quota/quota_v2.c:124: warning: integer constant is too large for ‘long’ type
> 
> 
> Can this patch be fixed?
  Ops, yes. I didn't see these warnings because I'm using 64-bit
machines... Thanks for the fix. You actually have to use ULL as Joe pointed
out. So I've merged the patch below:

>From 0ec834cacfc98633133b5a90c951f2d02e341048 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 15 Dec 2009 22:24:36 +0100
Subject: [PATCH] quota: Fix 64-bit limits setting on 32-bit archs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Fix warnings:
fs/quota/quota_v2.c: In function ‘v2_read_file_info’:
fs/quota/quota_v2.c:123: warning: integer constant is too large for ‘long’ type
fs/quota/quota_v2.c:124: warning: integer constant is too large for ‘long’ type

Reported-by: Jerry Leo <jerryleo860202@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota_v2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 3dfc23e..669855c 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -120,8 +120,8 @@ static int v2_read_file_info(struct super_block *sb, int type)
 		info->dqi_maxilimit = 0xffffffff;
 	} else {
 		/* used space is stored as unsigned 64-bit value */
-		info->dqi_maxblimit = 0xffffffffffffffff;	/* 2^64-1 */
-		info->dqi_maxilimit = 0xffffffffffffffff;
+		info->dqi_maxblimit = 0xffffffffffffffffULL;	/* 2^64-1 */
+		info->dqi_maxilimit = 0xffffffffffffffffULL;
 	}
 	info->dqi_bgrace = le32_to_cpu(dinfo.dqi_bgrace);
 	info->dqi_igrace = le32_to_cpu(dinfo.dqi_igrace);
-- 
1.6.4.2

-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] quota: integer constant is too large for ‘long’ type in
  2009-12-15 15:24 ` Joe Perches
@ 2009-12-15 21:30   ` Jan Kara
  0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2009-12-15 21:30 UTC (permalink / raw)
  To: Joe Perches; +Cc: Jerry Leo, jack, linux-kernel

On Tue 15-12-09 07:24:14, Joe Perches wrote:
> On Tue, 2009-12-15 at 21:27 +0800, Jerry Leo wrote:
> > -               info->dqi_maxblimit = 0xffffffffffffffff;       /* 2^64-1 */
> > -               info->dqi_maxilimit = 0xffffffffffffffff;
> > +               info->dqi_maxblimit = 0xFFFFFFFFFFFFFFFFLL;     /* 2^64-1 */
> > +               info->dqi_maxilimit = 0xFFFFFFFFFFFFFFFFLL;
> 
> ULLONG_MAX?
  Not quite - I want it to really be 2^64 - 1 (on disk type is u64)
so ULLONG_MAX would be confusing IMHO.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-12-15 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-15 13:27 [PATCH] quota: integer constant is too large for ‘long’ type in Jerry Leo
2009-12-15 15:24 ` Joe Perches
2009-12-15 21:30   ` Jan Kara
2009-12-15 21:28 ` Jan Kara

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.