aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/linux-2.6/xfs_lrw.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/linux-2.6/xfs_lrw.c')
-rw-r--r--fs/xfs/linux-2.6/xfs_lrw.c22
1 files changed, 3 insertions, 19 deletions
diff --git a/fs/xfs/linux-2.6/xfs_lrw.c b/fs/xfs/linux-2.6/xfs_lrw.c
index ff8d64eba9f8..558076dd0752 100644
--- a/fs/xfs/linux-2.6/xfs_lrw.c
+++ b/fs/xfs/linux-2.6/xfs_lrw.c
@@ -639,7 +639,6 @@ xfs_write(
639 xfs_fsize_t isize, new_size; 639 xfs_fsize_t isize, new_size;
640 xfs_iocore_t *io; 640 xfs_iocore_t *io;
641 bhv_vnode_t *vp; 641 bhv_vnode_t *vp;
642 unsigned long seg;
643 int iolock; 642 int iolock;
644 int eventsent = 0; 643 int eventsent = 0;
645 bhv_vrwlock_t locktype; 644 bhv_vrwlock_t locktype;
@@ -652,24 +651,9 @@ xfs_write(
652 vp = BHV_TO_VNODE(bdp); 651 vp = BHV_TO_VNODE(bdp);
653 xip = XFS_BHVTOI(bdp); 652 xip = XFS_BHVTOI(bdp);
654 653
655 for (seg = 0; seg < segs; seg++) { 654 error = generic_segment_checks(iovp, &segs, &ocount, VERIFY_READ);
656 const struct iovec *iv = &iovp[seg]; 655 if (error)
657 656 return error;
658 /*
659 * If any segment has a negative length, or the cumulative
660 * length ever wraps negative then return -EINVAL.
661 */
662 ocount += iv->iov_len;
663 if (unlikely((ssize_t)(ocount|iv->iov_len) < 0))
664 return -EINVAL;
665 if (access_ok(VERIFY_READ, iv->iov_base, iv->iov_len))
666 continue;
667 if (seg == 0)
668 return -EFAULT;
669 segs = seg;
670 ocount -= iv->iov_len; /* This segment is no good */
671 break;
672 }
673 657
674 count = ocount; 658 count = ocount;
675 pos = *offset; 659 pos = *offset;