Patchwork ext3/ioctl.c: quite sparse warnings about different address spaces

login
register
mail settings
Submitter hartleys
Date June 10, 2011, 9:59 p.m.
Message ID <201106101459.06129.hartleys@visionengravers.com>
Download mbox | patch
Permalink /patch/99954/
State New
Headers show

Comments

hartleys - June 10, 2011, 9:59 p.m.
The 'from' argument for copy_from_user and the 'to' argument for
copy_to_user should both be tagged as __user address space.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Dilger <adilger.kernel@dilger.ca>

---

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jan Kara - June 13, 2011, 1:47 p.m.
On Fri 10-06-11 14:59:05, H Hartley Sweeten wrote:
> The 'from' argument for copy_from_user and the 'to' argument for
> copy_to_user should both be tagged as __user address space.
> 
> Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andreas Dilger <adilger.kernel@dilger.ca>
  Thanks. Merged.

								Honza
> 
> ---
> 
> diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
> index f4090bd..c7f4394 100644
> --- a/fs/ext3/ioctl.c
> +++ b/fs/ext3/ioctl.c
> @@ -285,7 +285,7 @@ group_add_out:
>  		if (!capable(CAP_SYS_ADMIN))
>  			return -EPERM;
>  
> -		if (copy_from_user(&range, (struct fstrim_range *)arg,
> +		if (copy_from_user(&range, (struct fstrim_range __user *)arg,
>  				   sizeof(range)))
>  			return -EFAULT;
>  
> @@ -293,7 +293,7 @@ group_add_out:
>  		if (ret < 0)
>  			return ret;
>  
> -		if (copy_to_user((struct fstrim_range *)arg, &range,
> +		if (copy_to_user((struct fstrim_range __user *)arg, &range,
>  				 sizeof(range)))
>  			return -EFAULT;
>

Patch

diff --git a/fs/ext3/ioctl.c b/fs/ext3/ioctl.c
index f4090bd..c7f4394 100644
--- a/fs/ext3/ioctl.c
+++ b/fs/ext3/ioctl.c
@@ -285,7 +285,7 @@  group_add_out:
 		if (!capable(CAP_SYS_ADMIN))
 			return -EPERM;
 
-		if (copy_from_user(&range, (struct fstrim_range *)arg,
+		if (copy_from_user(&range, (struct fstrim_range __user *)arg,
 				   sizeof(range)))
 			return -EFAULT;
 
@@ -293,7 +293,7 @@  group_add_out:
 		if (ret < 0)
 			return ret;
 
-		if (copy_to_user((struct fstrim_range *)arg, &range,
+		if (copy_to_user((struct fstrim_range __user *)arg, &range,
 				 sizeof(range)))
 			return -EFAULT;