diff options
Diffstat (limited to 'fs/ioctl.c')
-rw-r--r-- | fs/ioctl.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/ioctl.c b/fs/ioctl.c index d6cc16476620..a59635e295fa 100644 --- a/fs/ioctl.c +++ b/fs/ioctl.c | |||
@@ -86,7 +86,7 @@ int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical, | |||
86 | u64 phys, u64 len, u32 flags) | 86 | u64 phys, u64 len, u32 flags) |
87 | { | 87 | { |
88 | struct fiemap_extent extent; | 88 | struct fiemap_extent extent; |
89 | struct fiemap_extent *dest = fieinfo->fi_extents_start; | 89 | struct fiemap_extent __user *dest = fieinfo->fi_extents_start; |
90 | 90 | ||
91 | /* only count the extents */ | 91 | /* only count the extents */ |
92 | if (fieinfo->fi_extents_max == 0) { | 92 | if (fieinfo->fi_extents_max == 0) { |
@@ -173,6 +173,7 @@ static int fiemap_check_ranges(struct super_block *sb, | |||
173 | static int ioctl_fiemap(struct file *filp, unsigned long arg) | 173 | static int ioctl_fiemap(struct file *filp, unsigned long arg) |
174 | { | 174 | { |
175 | struct fiemap fiemap; | 175 | struct fiemap fiemap; |
176 | struct fiemap __user *ufiemap = (struct fiemap __user *) arg; | ||
176 | struct fiemap_extent_info fieinfo = { 0, }; | 177 | struct fiemap_extent_info fieinfo = { 0, }; |
177 | struct inode *inode = filp->f_path.dentry->d_inode; | 178 | struct inode *inode = filp->f_path.dentry->d_inode; |
178 | struct super_block *sb = inode->i_sb; | 179 | struct super_block *sb = inode->i_sb; |
@@ -182,8 +183,7 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg) | |||
182 | if (!inode->i_op->fiemap) | 183 | if (!inode->i_op->fiemap) |
183 | return -EOPNOTSUPP; | 184 | return -EOPNOTSUPP; |
184 | 185 | ||
185 | if (copy_from_user(&fiemap, (struct fiemap __user *)arg, | 186 | if (copy_from_user(&fiemap, ufiemap, sizeof(fiemap))) |
186 | sizeof(struct fiemap))) | ||
187 | return -EFAULT; | 187 | return -EFAULT; |
188 | 188 | ||
189 | if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS) | 189 | if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS) |
@@ -196,7 +196,7 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg) | |||
196 | 196 | ||
197 | fieinfo.fi_flags = fiemap.fm_flags; | 197 | fieinfo.fi_flags = fiemap.fm_flags; |
198 | fieinfo.fi_extents_max = fiemap.fm_extent_count; | 198 | fieinfo.fi_extents_max = fiemap.fm_extent_count; |
199 | fieinfo.fi_extents_start = (struct fiemap_extent *)(arg + sizeof(fiemap)); | 199 | fieinfo.fi_extents_start = ufiemap->fm_extents; |
200 | 200 | ||
201 | if (fiemap.fm_extent_count != 0 && | 201 | if (fiemap.fm_extent_count != 0 && |
202 | !access_ok(VERIFY_WRITE, fieinfo.fi_extents_start, | 202 | !access_ok(VERIFY_WRITE, fieinfo.fi_extents_start, |
@@ -209,7 +209,7 @@ static int ioctl_fiemap(struct file *filp, unsigned long arg) | |||
209 | error = inode->i_op->fiemap(inode, &fieinfo, fiemap.fm_start, len); | 209 | error = inode->i_op->fiemap(inode, &fieinfo, fiemap.fm_start, len); |
210 | fiemap.fm_flags = fieinfo.fi_flags; | 210 | fiemap.fm_flags = fieinfo.fi_flags; |
211 | fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped; | 211 | fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped; |
212 | if (copy_to_user((char *)arg, &fiemap, sizeof(fiemap))) | 212 | if (copy_to_user(ufiemap, &fiemap, sizeof(fiemap))) |
213 | error = -EFAULT; | 213 | error = -EFAULT; |
214 | 214 | ||
215 | return error; | 215 | return error; |