Re: 2.6.5-mc2

From: William Lee Irwin III
Date: Wed Apr 07 2004 - 13:12:00 EST


On Wed, Apr 07, 2004 at 11:04:30AM -0700, William Lee Irwin III wrote:
> + if (sizeof(unsigned long) == 8)

Ugh.


Index: wli-2.6.5-3/fs/open.c
===================================================================
--- wli-2.6.5-3.orig/fs/open.c 2004-04-07 07:18:19.000000000 -0700
+++ wli-2.6.5-3/fs/open.c 2004-04-07 11:06:49.000000000 -0700
@@ -44,6 +44,13 @@

EXPORT_SYMBOL(vfs_statfs);

+static inline int vfs_statfs_overflow(unsigned long x)
+{
+ if (sizeof(unsigned long) == 4)
+ return 0;
+ return x != ~0UL && x > ((1UL << (BITS_PER_LONG/2)) - 1);
+}
+
static int vfs_statfs_native(struct super_block *sb, struct statfs *buf)
{
struct kstatfs st;
@@ -64,11 +71,9 @@
* f_files and f_ffree may be -1; it's okay to stuff
* that into 32 bits
*/
- if (st.f_files != 0xffffffffffffffffULL &&
- (st.f_files & 0xffffffff00000000ULL))
+ if (vfs_statfs_overflow(st.f_files))
return -EOVERFLOW;
- if (st.f_ffree != 0xffffffffffffffffULL &&
- (st.f_ffree & 0xffffffff00000000ULL))
+ if (vfs_statfs_overflow(st.f_ffree))
return -EOVERFLOW;
}

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