diff options
author | Milan Broz <mbroz@redhat.com> | 2008-02-07 21:09:56 -0500 |
---|---|---|
committer | Alasdair G Kergon <agk@redhat.com> | 2008-02-07 21:09:56 -0500 |
commit | 76c072b48e39e9291fbf02d6c912cf27d65e093d (patch) | |
tree | 5f5c523a48c014448b28a1a875ed8432fe79807a /drivers/md/dm-ioctl.c | |
parent | 27238b2bea89b1808b570bece6777ab2abc52fe2 (diff) |
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 @@ | |||
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/dm-ioctl.h> | 16 | #include <linux/dm-ioctl.h> |
17 | #include <linux/hdreg.h> | 17 | #include <linux/hdreg.h> |
18 | #include <linux/compat.h> | ||
18 | 19 | ||
19 | #include <asm/uaccess.h> | 20 | #include <asm/uaccess.h> |
20 | 21 | ||
@@ -1350,10 +1351,10 @@ static int copy_params(struct dm_ioctl __user *user, struct dm_ioctl **param) | |||
1350 | { | 1351 | { |
1351 | struct dm_ioctl tmp, *dmi; | 1352 | struct dm_ioctl tmp, *dmi; |
1352 | 1353 | ||
1353 | if (copy_from_user(&tmp, user, sizeof(tmp))) | 1354 | if (copy_from_user(&tmp, user, sizeof(tmp) - sizeof(tmp.data))) |
1354 | return -EFAULT; | 1355 | return -EFAULT; |
1355 | 1356 | ||
1356 | if (tmp.data_size < sizeof(tmp)) | 1357 | if (tmp.data_size < (sizeof(tmp) - sizeof(tmp.data))) |
1357 | return -EINVAL; | 1358 | return -EINVAL; |
1358 | 1359 | ||
1359 | dmi = vmalloc(tmp.data_size); | 1360 | dmi = vmalloc(tmp.data_size); |
@@ -1474,8 +1475,18 @@ static long dm_ctl_ioctl(struct file *file, uint command, ulong u) | |||
1474 | return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u); | 1475 | return (long)ctl_ioctl(command, (struct dm_ioctl __user *)u); |
1475 | } | 1476 | } |
1476 | 1477 | ||
1478 | #ifdef CONFIG_COMPAT | ||
1479 | static long dm_compat_ctl_ioctl(struct file *file, uint command, ulong u) | ||
1480 | { | ||
1481 | return (long)dm_ctl_ioctl(file, command, (ulong) compat_ptr(u)); | ||
1482 | } | ||
1483 | #else | ||
1484 | #define dm_compat_ctl_ioctl NULL | ||
1485 | #endif | ||
1486 | |||
1477 | static const struct file_operations _ctl_fops = { | 1487 | static const struct file_operations _ctl_fops = { |
1478 | .unlocked_ioctl = dm_ctl_ioctl, | 1488 | .unlocked_ioctl = dm_ctl_ioctl, |
1489 | .compat_ioctl = dm_compat_ctl_ioctl, | ||
1479 | .owner = THIS_MODULE, | 1490 | .owner = THIS_MODULE, |
1480 | }; | 1491 | }; |
1481 | 1492 | ||