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

Keith Packard keithp at keithp.com
Thu Nov 17 21:52:45 CET 2011


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.sig>


More information about the Intel-gfx mailing list