On Tue, Aug 23, 2022 at 03:12:14PM +0100, David Howells wrote: > + ret = iov_iter_get_pages2(orig, pages, count, max_pages - npages, > + &start); > + if (ret < 0) { > + pr_err("Couldn't get user pages (rc=%zd)\n", ret); > + break; > + } > + > + if (ret > count) { > + pr_err("get_pages rc=%zd more than %zu\n", ret, count); > + break; > + } > + > + iov_iter_advance(orig, ret); Have you even tested that? iov_iter_get_pages2() advances the iterator it had been given. And no, it does *not* return more than it had been asked to, so the second check is complete BS. That's aside of the usefulness of the primitive in question...