orangefs_bufmap_copy_from_iovec(): fix EFAULT handling
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 13 Apr 2017 07:10:18 +0000 (03:10 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Mon, 17 Apr 2017 18:23:20 +0000 (14:23 -0400)
short copy here should mean instant EFAULT, not "move to the
next page and hope it fails there, this time with nothing
copied"

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/orangefs/orangefs-bufmap.c

index 6333cbb..83b5060 100644 (file)
@@ -521,13 +521,11 @@ int orangefs_bufmap_copy_from_iovec(struct iov_iter *iter,
                size_t n = size;
                if (n > PAGE_SIZE)
                        n = PAGE_SIZE;
-               n = copy_page_from_iter(page, 0, n, iter);
-               if (!n)
+               if (copy_page_from_iter(page, 0, n, iter) != n)
                        return -EFAULT;
                size -= n;
        }
        return 0;
-
 }
 
 /*