Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wright <chrisw@sous-sol.org>2006-03-01 23:19:25 -0800
committerChris Wright <chrisw@sous-sol.org>2006-03-05 11:07:18 -0800
commit166f00bf649517bb377b23e668b3fd52497f63d0 (patch)
treebe263c46a67cfb21b0dc4089cc7a52db36f28181
parente8dc2c9e3c9ca640742630481329abb727f2dc6b (diff)
[PATCH] fs/nfs/direct.c compile fix
Compile fix: fs/nfs/direct.c: In function 'nfs_get_user_pages': fs/nfs/direct.c:110: warning: implicit declaration of function 'nfs_free_user_pages' fs/nfs/direct.c: At top level: fs/nfs/direct.c:127: warning: conflicting types for 'nfs_free_user_pages' fs/nfs/direct.c:127: error: static declaration of 'nfs_free_user_pages' follows non-static declaration fs/nfs/direct.c:110: error: previous implicit declaration of 'nfs_free_user_pages' was here This should now be the same as fix that's going upstream. Signed-off-by: Chris Wright <chrisw@sous-sol.org> Acked-by: Trond Myklebust <trond.myklebust@fys.uio.no>
-rw-r--r--fs/nfs/direct.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c
index 3ebb06e62c20..96c104b7b41c 100644
--- a/fs/nfs/direct.c
+++ b/fs/nfs/direct.c
@@ -57,6 +57,7 @@
#define NFSDBG_FACILITY NFSDBG_VFS
#define MAX_DIRECTIO_SIZE (4096UL << PAGE_SHIFT)
+static void nfs_free_user_pages(struct page **pages, int npages, int do_dirty);
static kmem_cache_t *nfs_direct_cachep;
/*
@@ -106,12 +107,16 @@ nfs_get_user_pages(int rw, unsigned long user_addr, size_t size,
result = get_user_pages(current, current->mm, user_addr,
page_count, (rw == READ), 0,
*pages, NULL);
+ up_read(&current->mm->mmap_sem);
+ /*
+ * If we got fewer pages than expected from get_user_pages(),
+ * the user buffer runs off the end of a mapping; return EFAULT.
+ */
if (result >= 0 && result < page_count) {
nfs_free_user_pages(*pages, result, 0);
*pages = NULL;
result = -EFAULT;
}
- up_read(&current->mm->mmap_sem);
}
return result;
}