Skip to contentSkip to conversation

quota: integer constant is too large for ‘long’ type in

PATCH In review Jerry Leo 3 participants 4 messages Dec 15, 2009 Diskquota

lore
Share & tools
lore

Jerry Leo

author
#0 lore raw

PATCH 1/1 quota: integer constant is too large for ‘long’ type in

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?

linux-2.6/fs/quota/quota_v2.c renamed from linux-2.6/fs/quota/quota_v2.c.orig +0 -0
index 3dfc23e..be9ea1e 100644
@@ -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

#1 lore raw

Review

Quoted 4 lines · Jerry Leo
(quoted diff) +2 -2
-               info->dqi_maxblimit = 0xffffffffffffffff;       /* 2^64-1 */
-               info->dqi_maxilimit = 0xffffffffffffffff;
+               info->dqi_maxblimit = 0xFFFFFFFFFFFFFFFFLL;     /* 2^64-1 */
+               info->dqi_maxilimit = 0xFFFFFFFFFFFFFFFFLL;

ULLONG_MAX?

#2 lore raw
Quoted 7 lines · Joe Perches

Review

Quoted 4 lines · Jerry Leo
(quoted diff) +2 -2
-               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

Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
#3 lore raw
In reply to Jerry Leo
Quoted 11 lines · Jerry Leo

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:

Quoted 1 line

From 0ec834cacfc98633133b5a90c951f2d02e341048 Mon Sep 17 00:00:00 2001

From: Jan Kara <[email protected]>
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

---
 fs/quota/quota_v2.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
fs/quota/quota_v2.c +2 -2
index 3dfc23e..669855c 100644
@@ -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);
Signature · 5 lines
1.6.4.2

-- 
Jan Kara <[email protected]>
SUSE Labs, CR