Skip to contentSkip to conversation

ext4/ioctl.c: copy_{from,to}_user expect __user pointers

PATCH Applied H Hartley Sweeten 2 participants 2 messages Sep 23, 2011 – Oct 12, 2011 ext4 file system

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ext4/ioctl.c: copy_{from,to}_user expect __user pointers

This quiets the sparse noise:

warning: incorrect type in argument 2 (different address spaces)
expected void const [noderef] <asn:1>*from
got struct fstrim_range *<noident>
warning: incorrect type in argument 1 (different address spaces)
expected void [noderef] <asn:1>*to
got struct fstrim_range *<noident>

Cc "Theodore Ts'o" <[email protected]>
Cc Andreas Dilger <[email protected]>

---

fs/ext4/ioctl.c +2 -2
index f18bfe3..43759b1 100644
@@ -348,7 +348,7 @@ mext_out:
 		if (!blk_queue_discard(q))
 			return -EOPNOTSUPP;
 
-		if (copy_from_user(&range, (struct fstrim_range *)arg,
+		if (copy_from_user(&range, (struct fstrim_range __user *)arg,
 		    sizeof(range)))
 			return -EFAULT;
 
@@ -358,7 +358,7 @@ mext_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;
 
maintainer Applied
#1 lore raw
Quoted 9 lines · H Hartley Sweeten

This quiets the sparse noise:

warning: incorrect type in argument 2 (different address spaces)
expected void const [noderef] <asn:1>*from
got struct fstrim_range *<noident>
warning: incorrect type in argument 1 (different address spaces)
expected void [noderef] <asn:1>*to
got struct fstrim_range *<noident>

Quoted 3 lines
Cc "Theodore Ts'o" <[email protected]>
Cc Andreas Dilger <[email protected]>

Thanks, applied.

- Ted