aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ntfs
diff options
context:
space:
mode:
authorDmitriy Monakhov <dmonakhov@openvz.org>2007-05-08 03:23:02 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-05-08 14:14:57 -0400
commit0ceb331433e8aad9c5f441a965d7c681f8b9046f (patch)
treefd3d679a4015242dd65f0721f52242ad47619910 /fs/ntfs
parentb46b8f19c9cd435ecac4d9d12b39d78c137ecd66 (diff)
mm: move common segment checks to separate helper function
[akpm@linux-foundation.org: cleanup] Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org> Cc: Christoph Hellwig <hch@lst.de> Acked-by: Anton Altaparmakov <aia21@cam.ac.uk> Acked-by: David Chinner <dgc@sgi.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/ntfs')
-rw-r--r--fs/ntfs/file.c21
1 files changed, 3 insertions, 18 deletions
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c
index dbbac5593106..621de369e6f8 100644
--- a/fs/ntfs/file.c
+++ b/fs/ntfs/file.c
@@ -2129,28 +2129,13 @@ static ssize_t ntfs_file_aio_write_nolock(struct kiocb *iocb,
2129 struct address_space *mapping = file->f_mapping; 2129 struct address_space *mapping = file->f_mapping;
2130 struct inode *inode = mapping->host; 2130 struct inode *inode = mapping->host;
2131 loff_t pos; 2131 loff_t pos;
2132 unsigned long seg;
2133 size_t count; /* after file limit checks */ 2132 size_t count; /* after file limit checks */
2134 ssize_t written, err; 2133 ssize_t written, err;
2135 2134
2136 count = 0; 2135 count = 0;
2137 for (seg = 0; seg < nr_segs; seg++) { 2136 err = generic_segment_checks(iov, &nr_segs, &count, VERIFY_READ);
2138 const struct iovec *iv = &iov[seg]; 2137 if (err)
2139 /* 2138 return err;
2140 * If any segment has a negative length, or the cumulative
2141 * length ever wraps negative then return -EINVAL.
2142 */
2143 count += iv->iov_len;
2144 if (unlikely((ssize_t)(count|iv->iov_len) < 0))
2145 return -EINVAL;
2146 if (access_ok(VERIFY_READ, iv->iov_base, iv->iov_len))
2147 continue;
2148 if (!seg)
2149 return -EFAULT;
2150 nr_segs = seg;
2151 count -= iv->iov_len; /* This segment is no good */
2152 break;
2153 }
2154 pos = *ppos; 2139 pos = *ppos;
2155 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE); 2140 vfs_check_frozen(inode->i_sb, SB_FREEZE_WRITE);
2156 /* We can write back this queue in page reclaim. */ 2141 /* We can write back this queue in page reclaim. */