diff options
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_ioctl32.c')
-rw-r--r-- | fs/xfs/linux-2.6/xfs_ioctl32.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c index a97022f2d9b0..2d336062831d 100644 --- a/fs/xfs/linux-2.6/xfs_ioctl32.c +++ b/fs/xfs/linux-2.6/xfs_ioctl32.c | |||
@@ -192,35 +192,43 @@ xfs_bstime_store_compat( | |||
192 | return 0; | 192 | return 0; |
193 | } | 193 | } |
194 | 194 | ||
195 | /* Return 0 on success or positive error (to xfs_bulkstat()) */ | ||
195 | STATIC int | 196 | STATIC int |
196 | xfs_bulkstat_one_fmt_compat( | 197 | xfs_bulkstat_one_fmt_compat( |
197 | void __user *ubuffer, | 198 | void __user *ubuffer, |
199 | int ubsize, | ||
200 | int *ubused, | ||
198 | const xfs_bstat_t *buffer) | 201 | const xfs_bstat_t *buffer) |
199 | { | 202 | { |
200 | compat_xfs_bstat_t __user *p32 = ubuffer; | 203 | compat_xfs_bstat_t __user *p32 = ubuffer; |
201 | 204 | ||
202 | if (put_user(buffer->bs_ino, &p32->bs_ino) || | 205 | if (ubsize < sizeof(*p32)) |
203 | put_user(buffer->bs_mode, &p32->bs_mode) || | 206 | return XFS_ERROR(ENOMEM); |
204 | put_user(buffer->bs_nlink, &p32->bs_nlink) || | 207 | |
205 | put_user(buffer->bs_uid, &p32->bs_uid) || | 208 | if (put_user(buffer->bs_ino, &p32->bs_ino) || |
206 | put_user(buffer->bs_gid, &p32->bs_gid) || | 209 | put_user(buffer->bs_mode, &p32->bs_mode) || |
207 | put_user(buffer->bs_rdev, &p32->bs_rdev) || | 210 | put_user(buffer->bs_nlink, &p32->bs_nlink) || |
208 | put_user(buffer->bs_blksize, &p32->bs_blksize) || | 211 | put_user(buffer->bs_uid, &p32->bs_uid) || |
209 | put_user(buffer->bs_size, &p32->bs_size) || | 212 | put_user(buffer->bs_gid, &p32->bs_gid) || |
213 | put_user(buffer->bs_rdev, &p32->bs_rdev) || | ||
214 | put_user(buffer->bs_blksize, &p32->bs_blksize) || | ||
215 | put_user(buffer->bs_size, &p32->bs_size) || | ||
210 | xfs_bstime_store_compat(&p32->bs_atime, &buffer->bs_atime) || | 216 | xfs_bstime_store_compat(&p32->bs_atime, &buffer->bs_atime) || |
211 | xfs_bstime_store_compat(&p32->bs_mtime, &buffer->bs_mtime) || | 217 | xfs_bstime_store_compat(&p32->bs_mtime, &buffer->bs_mtime) || |
212 | xfs_bstime_store_compat(&p32->bs_ctime, &buffer->bs_ctime) || | 218 | xfs_bstime_store_compat(&p32->bs_ctime, &buffer->bs_ctime) || |
213 | put_user(buffer->bs_blocks, &p32->bs_blocks) || | 219 | put_user(buffer->bs_blocks, &p32->bs_blocks) || |
214 | put_user(buffer->bs_xflags, &p32->bs_xflags) || | 220 | put_user(buffer->bs_xflags, &p32->bs_xflags) || |
215 | put_user(buffer->bs_extsize, &p32->bs_extsize) || | 221 | put_user(buffer->bs_extsize, &p32->bs_extsize) || |
216 | put_user(buffer->bs_extents, &p32->bs_extents) || | 222 | put_user(buffer->bs_extents, &p32->bs_extents) || |
217 | put_user(buffer->bs_gen, &p32->bs_gen) || | 223 | put_user(buffer->bs_gen, &p32->bs_gen) || |
218 | put_user(buffer->bs_projid, &p32->bs_projid) || | 224 | put_user(buffer->bs_projid, &p32->bs_projid) || |
219 | put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) || | 225 | put_user(buffer->bs_dmevmask, &p32->bs_dmevmask) || |
220 | put_user(buffer->bs_dmstate, &p32->bs_dmstate) || | 226 | put_user(buffer->bs_dmstate, &p32->bs_dmstate) || |
221 | put_user(buffer->bs_aextents, &p32->bs_aextents)) | 227 | put_user(buffer->bs_aextents, &p32->bs_aextents)) |
222 | return -XFS_ERROR(EFAULT); | 228 | return XFS_ERROR(EFAULT); |
223 | return sizeof(*p32); | 229 | if (ubused) |
230 | *ubused = sizeof(*p32); | ||
231 | return 0; | ||
224 | } | 232 | } |
225 | 233 | ||
226 | STATIC int | 234 | STATIC int |