aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nilfs2/ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nilfs2/ioctl.c')
-rw-r--r--fs/nilfs2/ioctl.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c
index 85a291ccc1be..7fbd9fe1d035 100644
--- a/fs/nilfs2/ioctl.c
+++ b/fs/nilfs2/ioctl.c
@@ -41,6 +41,7 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
41 void *, size_t, size_t)) 41 void *, size_t, size_t))
42{ 42{
43 void *buf; 43 void *buf;
44 void __user *base = (void __user *)(unsigned long)argv->v_base;
44 size_t maxmembs, total, n; 45 size_t maxmembs, total, n;
45 ssize_t nr; 46 ssize_t nr;
46 int ret, i; 47 int ret, i;
@@ -64,9 +65,8 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
64 n = (argv->v_nmembs - i < maxmembs) ? 65 n = (argv->v_nmembs - i < maxmembs) ?
65 argv->v_nmembs - i : maxmembs; 66 argv->v_nmembs - i : maxmembs;
66 if ((dir & _IOC_WRITE) && 67 if ((dir & _IOC_WRITE) &&
67 copy_from_user(buf, 68 copy_from_user(buf, base + argv->v_size * i,
68 (void __user *)argv->v_base + argv->v_size * i, 69 argv->v_size * n)) {
69 argv->v_size * n)) {
70 ret = -EFAULT; 70 ret = -EFAULT;
71 break; 71 break;
72 } 72 }
@@ -78,9 +78,8 @@ static int nilfs_ioctl_wrap_copy(struct the_nilfs *nilfs,
78 break; 78 break;
79 } 79 }
80 if ((dir & _IOC_READ) && 80 if ((dir & _IOC_READ) &&
81 copy_to_user( 81 copy_to_user(base + argv->v_size * i, buf,
82 (void __user *)argv->v_base + argv->v_size * i, 82 argv->v_size * nr)) {
83 buf, argv->v_size * nr)) {
84 ret = -EFAULT; 83 ret = -EFAULT;
85 break; 84 break;
86 } 85 }