patchlet for linux/fs.h

Richard Henderson (rth@cygnus.com)
Tue, 27 Jun 2000 15:08:54 -0700


Previously this was going unnoticed becuase abs resolved to __builtin_abs.
Recent versions of gcc do not fail to emit the "no declaration" warning
with builtins, which brings it to my attention.

The use of abs is incorrect because the definition is `int abs(int)',
which does not do what you want with loff_t.

r~

--- include/linux/fs.h.orig Tue Jun 27 14:58:55 2000
+++ include/linux/fs.h Tue Jun 27 14:59:33 2000
@@ -864,7 +864,8 @@ static inline int locks_verify_truncate(
return locks_mandatory_area(
FLOCK_VERIFY_WRITE, inode, filp,
size < inode->i_size ? size : inode->i_size,
- abs(inode->i_size - size)
+ (size < inode->i_size ? inode->i_size - size
+ : size - inode->i_size)
);
return 0;
}

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