diff options
author | Milan Broz <mbroz@redhat.com> | 2008-02-08 03:09:56 +0100 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-02-08 03:09:56 +0100 |
commit | 76c072b48e39e9291fbf02d6c912cf27d65e093d (patch) | |
tree | 5f5c523a48c014448b28a1a875ed8432fe79807a /drivers/md/dm-ioctl.c | |
parent | dm ioctl: remove lock_kernel (diff) | |
download | linux-76c072b48e39e9291fbf02d6c912cf27d65e093d.tar.xz linux-76c072b48e39e9291fbf02d6c912cf27d65e093d.zip |
dm ioctl: move compat code
Move compat_ioctl handling into dm-ioctl.c.
Signed-off-by: Milan Broz <mbroz@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-ioctl.c')
-rw-r--r-- | drivers/md/dm-ioctl.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c index 4aa1f78b78f0..9c491397a51d 100644 --- a/drivers/md/dm-ioctl.c +++ b/drivers/md/dm-ioctl.c @@ -15,6 +15,7 @@ #include <linux/slab.h> #include <linux/dm-ioctl.h> #include <linux/hdreg.h> +#include <linux/compat.h> #include <asm/uaccess.h> @@ -1350,10 +1351,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) { struct dm_ioctl tmp, *dmi; - if (copy_from_user(&tmp, user, sizeof(tmp))) + if (copy_from_user(&tmp, user, sizeof(tmp) - sizeof(tmp.data))) return -EFAULT; - if (tmp.data_size < sizeof(tmp)) + if (tmp.data_size < (sizeof(tmp) - sizeof(tmp.data))) return -EINVAL; dmi = vmalloc(tmp.data_size); @@ -1474,8 +1475,18 @@ static long dm_ctl_ioctl(struct file *file, uint command, ulong u) return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u); } +#ifdef CONFIG_COMPAT +static long dm_compat_ctl_ioctl(struct file *file, uint command, ulong u) +{ + return (long)dm_ctl_ioctl(file, command, (ulong) compat_ptr(u)); +} +#else +#define dm_compat_ctl_ioctl NULL +#endif + static const struct file_operations _ctl_fops = { .unlocked_ioctl = dm_ctl_ioctl, + .compat_ioctl = dm_compat_ctl_ioctl, .owner = THIS_MODULE, }; |