aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/compat.c4
-rw-r--r--fs/read_write.c14
2 files changed, 12 insertions, 6 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 1c859dae758f..3f84d5f15889 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1236,7 +1236,7 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
1236 1236
1237asmlinkage ssize_t 1237asmlinkage ssize_t
1238compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec, 1238compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
1239 unsigned long vlen, u32 pos_high, u32 pos_low) 1239 unsigned long vlen, u32 pos_low, u32 pos_high)
1240{ 1240{
1241 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1241 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1242 struct file *file; 1242 struct file *file;
@@ -1293,7 +1293,7 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
1293 1293
1294asmlinkage ssize_t 1294asmlinkage ssize_t
1295compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec, 1295compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
1296 unsigned long vlen, u32 pos_high, u32 pos_low) 1296 unsigned long vlen, u32 pos_low, u32 pos_high)
1297{ 1297{
1298 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 1298 loff_t pos = ((loff_t)pos_high << 32) | pos_low;
1299 struct file *file; 1299 struct file *file;
diff --git a/fs/read_write.c b/fs/read_write.c
index 6d5d8ff238aa..9d1e76bb9ee1 100644
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@ -731,10 +731,16 @@ SYSCALL_DEFINE3(writev, unsigned long, fd, const struct iovec __user *, vec,
731 return ret; 731 return ret;
732} 732}
733 733
734static inline loff_t pos_from_hilo(unsigned long high, unsigned long low)
735{
736#define HALF_LONG_BITS (BITS_PER_LONG / 2)
737 return (((loff_t)high << HALF_LONG_BITS) << HALF_LONG_BITS) | low;
738}
739
734SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec, 740SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
735 unsigned long, vlen, u32, pos_high, u32, pos_low) 741 unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)
736{ 742{
737 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 743 loff_t pos = pos_from_hilo(pos_h, pos_l);
738 struct file *file; 744 struct file *file;
739 ssize_t ret = -EBADF; 745 ssize_t ret = -EBADF;
740 int fput_needed; 746 int fput_needed;
@@ -757,9 +763,9 @@ SYSCALL_DEFINE5(preadv, unsigned long, fd, const struct iovec __user *, vec,
757} 763}
758 764
759SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec, 765SYSCALL_DEFINE5(pwritev, unsigned long, fd, const struct iovec __user *, vec,
760 unsigned long, vlen, u32, pos_high, u32, pos_low) 766 unsigned long, vlen, unsigned long, pos_l, unsigned long, pos_h)
761{ 767{
762 loff_t pos = ((loff_t)pos_high << 32) | pos_low; 768 loff_t pos = pos_from_hilo(pos_h, pos_l);
763 struct file *file; 769 struct file *file;
764 ssize_t ret = -EBADF; 770 ssize_t ret = -EBADF;
765 int fput_needed; 771 int fput_needed;