Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934838Ab3JPOQv (ORCPT ); Wed, 16 Oct 2013 10:16:51 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:26582 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934564Ab3JPOFu (ORCPT ); Wed, 16 Oct 2013 10:05:50 -0400 From: Dave Kleikamp To: linux-kernel@vger.kernel.org Cc: linux-fsdevel@vger.kernel.org, Andrew Morton , "Maxim V. Patlasov" , Zach Brown , Christoph Hellwig , Dave Kleikamp , fuse-devel@lists.sourceforge.net Subject: [PATCH V9 05/33] fuse: convert fuse to use iov_iter_copy_[to|from]_user Date: Wed, 16 Oct 2013 09:04:18 -0500 Message-Id: <1381932286-14978-6-git-send-email-dave.kleikamp@oracle.com> X-Mailer: git-send-email 1.8.4 In-Reply-To: <1381932286-14978-1-git-send-email-dave.kleikamp@oracle.com> References: <1381932286-14978-1-git-send-email-dave.kleikamp@oracle.com> X-Source-IP: acsinet22.oracle.com [141.146.126.238] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1741 Lines: 62 A future patch hides the internals of struct iov_iter, so fuse should be using the supported interface. Signed-off-by: Dave Kleikamp Acked-by: Miklos Szeredi Tested-by: Sedat Dilek Cc: fuse-devel@lists.sourceforge.net --- fs/fuse/file.c | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 4598345..606ff63 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -1868,30 +1868,17 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov, while (iov_iter_count(&ii)) { struct page *page = pages[page_idx++]; size_t todo = min_t(size_t, PAGE_SIZE, iov_iter_count(&ii)); - void *kaddr; + size_t left; - kaddr = kmap(page); - - while (todo) { - char __user *uaddr = ii.iov->iov_base + ii.iov_offset; - size_t iov_len = ii.iov->iov_len - ii.iov_offset; - size_t copy = min(todo, iov_len); - size_t left; - - if (!to_user) - left = copy_from_user(kaddr, uaddr, copy); - else - left = copy_to_user(uaddr, kaddr, copy); - - if (unlikely(left)) - return -EFAULT; + if (!to_user) + left = iov_iter_copy_from_user(page, &ii, 0, todo); + else + left = iov_iter_copy_to_user(page, &ii, 0, todo); - iov_iter_advance(&ii, copy); - todo -= copy; - kaddr += copy; - } + if (unlikely(left)) + return -EFAULT; - kunmap(page); + iov_iter_advance(&ii, todo); } return 0; -- 1.8.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/