[PATCH 2/2] drm/i915: properly prefault for pread/pwrite

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

 



On Wed, 28 Sep 2011 11:57:24 +0200, Daniel Vetter <daniel.vetter at ffwll.ch> wrote:

> +	char __user *end = uaddr + size - 1;

...

> +	if (ret == 0) {
> +		if (((unsigned long)uaddr & PAGE_MASK) !=
> +				((unsigned long)end & PAGE_MASK))
> +		 	ret = __put_user(0, end);
> +	}

This is wrong -- if size == PAGE_SIZE, then we'll be doing an extra
write at 'end' every time (and, I imagine that's a common case).

And, you mentioned a 'better' fix?

-- 
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20111117/5154cd3a/attachment.pgp>


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