Thread (32 messages) flat view 32 messages, 6 authors, 2019-06-06

Re: [PATCH 03/16] mm: simplify gup_fast_permitted

From: Christoph Hellwig <hch@lst.de>
Date: 2019-06-03 07:41:51
Also in: linux-mips, linux-mm, linux-sh, lkml, sparclinux

On Sat, Jun 01, 2019 at 09:14:17AM -0700, Linus Torvalds wrote:
On Sat, Jun 1, 2019 at 12:50 AM Christoph Hellwig [off-list ref] wrote:
quoted
Pass in the already calculated end value instead of recomputing it, and
leave the end > start check in the callers instead of duplicating them
in the arch code.
Good cleanup, except it's wrong.
quoted
-       if (nr_pages <= 0)
+       if (end < start)
                return 0;
You moved the overflow test to generic code - good.

You removed the sign and zero test on nr_pages - bad.
I only removed a duplicate of it.  The full (old) code in
get_user_pages_fast() looks like this:

	if (nr_pages <= 0)
		return 0;

	if (unlikely(!access_ok((void __user *)start, len)))
		return -EFAULT;

	if (gup_fast_permitted(start, nr_pages)) {
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help