[XFS] Move copy_from_user calls out of ioctl helpers into ioctl switch.

Moving the copy_from_user out of some of the ioctl helpers will
make it easier for the compat ioctl switch to copy in the right
struct, then just pass to the underlying helper.

Also, move common access checks into the helpers themselves,
and out of the native ioctl switch code, to reduce code
duplication between native & compat ioctl callers.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>
This commit is contained in:
sandeen@sandeen.net
2008-11-25 21:20:06 -06:00
committed by Lachlan McIlroy
parent 0e446673a1
commit 743bb4650d
5 changed files with 63 additions and 64 deletions

View File

@@ -49,9 +49,8 @@
*/
int
xfs_swapext(
xfs_swapext_t __user *sxu)
xfs_swapext_t *sxp)
{
xfs_swapext_t *sxp;
xfs_inode_t *ip, *tip;
struct file *file, *target_file;
int error = 0;
@@ -62,11 +61,6 @@ xfs_swapext(
goto out;
}
if (copy_from_user(sxp, sxu, sizeof(xfs_swapext_t))) {
error = XFS_ERROR(EFAULT);
goto out_free_sxp;
}
/* Pull information for the target fd */
file = fget((int)sxp->sx_fdtarget);
if (!file) {