Re: Using __user with compat_uptr_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Tue, 26 Apr 2005, David Howells wrote:
> 
> For example, is this right?:
> 
> 	struct compat_nfs_string {
> 		compat_uint_t len;
> 		compat_uptr_t __user data;
> 	};

Nope. That makes "data" itself (the compat-pointer, not the thing it
points to) be marked as being in user space, which is not right.

> Or is this right?:
> 
> 	struct compat_nfs_string {
> 		compat_uint_t len;
> 		compat_uptr_t data;
> 	};

Yes. Now, when you use "compat_ptr()" on that thing, compat_ptr() will do 
the proper thing, and results in a "void __user *", so assuming you 
convert the pointer correctly, it will always end up having the right user 
annotation.

(Except on MIPS, where compat_ptr() doesn't, but MIPS hasn't been updated 
to do any sparse checking anyway).

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

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux