Skip to contentSkip to conversation

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

PATCH In review H Hartley Sweeten 2 participants 2 messages Jun 10, 2011 – Jun 13, 2011

lore
Share & tools
lore
#0 lore raw

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

The 'from' argument for copy_from_user and the 'to' argument for copy_to_user should both be tagged as __user address space.

Cc Jan Kara <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andreas Dilger <[email protected]>

---

fs/ext3/ioctl.c +2 -2
index f4090bd..c7f4394 100644
@@ -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;
 
#1 lore raw
Quoted 7 lines · H Hartley Sweeten

The 'from' argument for copy_from_user and the 'to' argument for copy_to_user should both be tagged as __user address space.

Cc Jan Kara <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andreas Dilger <[email protected]>

Thanks. Merged.

Honza

Quoted 25 lines

---

fs/ext3/ioctl.c +2 -2
index f4090bd..c7f4394 100644
@@ -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;
 
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR