aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2009-09-23 11:49:55 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 12:21:05 -0400
commit4fd8da8d62416d0dae05603ab5990a498d9aeb12 (patch)
tree81feb3cc66d49cfd89b0b26f067bbb52e164d0d8 /fs
parenta6e995ad7409403c5bbd6fe8f666a280e086bb22 (diff)
fs: change sys_truncate length parameter type
For this system call user space passes a signed long length parameter, while the kernel side takes an unsigned long parameter and converts it later to signed long again. This has led to bugs in compat wrappers see e.g. dd90bbd5 "powerpc: Add compat_sys_truncate". The s390 compat wrapper for this functions is broken as well since it also performs zero extension instead of sign extension for the length parameter. In addition if hpa comes up with an automated way of generating compat wrappers it would generate a wrong one here. So change the length parameter from unsigned long to long. Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/open.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/open.c b/fs/open.c
index 31191bf513e4..4f01e06227c6 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -290,10 +290,9 @@ out:
290 return error; 290 return error;
291} 291}
292 292
293SYSCALL_DEFINE2(truncate, const char __user *, path, unsigned long, length) 293SYSCALL_DEFINE2(truncate, const char __user *, path, long, length)
294{ 294{
295 /* on 32-bit boxen it will cut the range 2^31--2^32-1 off */ 295 return do_sys_truncate(path, length);
296 return do_sys_truncate(path, (long)length);
297} 296}
298 297
299static long do_sys_ftruncate(unsigned int fd, loff_t length, int small) 298static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)