[PATCH] drm/i915: Add to_user_ptr()

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

 



On Fri, Feb 22, 2013 at 12:16:58PM -0800, Andi Kleen wrote:
> ville.syrjala at linux.intel.com writes:
> 
> > From: Ville Syrj?l? <ville.syrjala at linux.intel.com>
> >
> > to_user_ptr() simply casts a pointer passed as u64 from user space
> > to void __user * correctly. Using this lets us get rid of all the
> > tiresome casts.
> 
> The whole point of __user is to track it elsewhere to avoid mistakes,
> which may result in security bugs.
> 
> A __user cast usually means your tracking is not complete, it's
> supposed to be ugly so that you fix the tracking. Prettying
> it defeats that point.
> 
> How about just changing the original field to a pointer and add
> the __user there?

That would introduce 32bit vs. 64bit issues. We pass all user space
pointer as __u64 precisely to avoid such issues.

-- 
Ville Syrj?l?
Intel OTC


[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux