[PATCH] dm ioctl: disambiguate the user pointer calculation

From: Scotty Bauer
Date: Wed Jan 06 2016 - 20:17:35 EST


This patch adds an & in front of user->version, in hopes of making
it clear that user-memory is not being touched.

Signed-off-by: Scotty Bauer <sbauer@xxxxxxxxxxxx>
---
drivers/md/dm-ioctl.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/md/dm-ioctl.c b/drivers/md/dm-ioctl.c
index fa5bf54..81190df 100644
--- a/drivers/md/dm-ioctl.c
+++ b/drivers/md/dm-ioctl.c
@@ -1642,13 +1642,9 @@ static ioctl_fn lookup_ioctl(unsigned int cmd, int *ioctl_flags)
static int check_version(unsigned int cmd, struct dm_ioctl __user *user)
{
uint32_t version[3];
- uint32_t __user *versionp;
int r = 0;

- if (copy_from_user(&versionp, &user->version, sizeof(versionp)))
- return -EFAULT;
-
- if (copy_from_user(version, versionp, sizeof(version)))
+ if (copy_from_user(version, &user->version, sizeof(version)))
return -EFAULT;

if ((DM_VERSION_MAJOR != version[0]) ||
@@ -1667,7 +1663,7 @@ static int check_version(unsigned int cmd, struct dm_ioctl __user *user)
version[0] = DM_VERSION_MAJOR;
version[1] = DM_VERSION_MINOR;
version[2] = DM_VERSION_PATCHLEVEL;
- if (copy_to_user(versionp, version, sizeof(version)))
+ if (copy_to_user(&user->version, version, sizeof(version)))
return -EFAULT;

return r;
--
1.9.1


--------------020004000808080902030600--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/