From 7f8f5a043ea63256f8a5f7454cea735ba722f6e8 Mon Sep 17 00:00:00 2001 From: Dave Chinner Date: Fri, 8 Jun 2012 15:45:44 +1000 Subject: [PATCH] --- yaml --- r: 319829 b: refs/heads/master c: 5276432997feb2366ac1e77949e94fe86a394813 h: refs/heads/master i: 319827: 8b954fee5f0fe380392c932207e034177d2a5a20 v: v3 --- [refs] | 2 +- trunk/fs/xfs/xfs_file.c | 17 +++-------------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/[refs] b/[refs] index a0cc65568892..66586e8b8f9b 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 32972383ca46223aa2b129826b3789721ec147aa +refs/heads/master: 5276432997feb2366ac1e77949e94fe86a394813 diff --git a/trunk/fs/xfs/xfs_file.c b/trunk/fs/xfs/xfs_file.c index 59e22c989cd4..c4559c6e6f2c 100644 --- a/trunk/fs/xfs/xfs_file.c +++ b/trunk/fs/xfs/xfs_file.c @@ -236,7 +236,6 @@ xfs_file_aio_read( ssize_t ret = 0; int ioflags = 0; xfs_fsize_t n; - unsigned long seg; XFS_STATS_INC(xs_read_calls); @@ -247,19 +246,9 @@ xfs_file_aio_read( if (file->f_mode & FMODE_NOCMTIME) ioflags |= IO_INVIS; - /* START copy & waste from filemap.c */ - for (seg = 0; seg < nr_segs; seg++) { - const struct iovec *iv = &iovp[seg]; - - /* - * If any segment has a negative length, or the cumulative - * length ever wraps negative then return -EINVAL. - */ - size += iv->iov_len; - if (unlikely((ssize_t)(size|iv->iov_len) < 0)) - return XFS_ERROR(-EINVAL); - } - /* END copy & waste from filemap.c */ + ret = generic_segment_checks(iovp, &nr_segs, &size, VERIFY_WRITE); + if (ret < 0) + return ret; if (unlikely(ioflags & IO_ISDIRECT)) { xfs_buftarg_t *target =