Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 57000
b: refs/heads/master
c: d9b08b9
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Hellwig authored and Mark Fasheh committed May 25, 2007
1 parent 4824755 commit b8025e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8fccfc829a66b8b879c6672940523a402a786ce1
refs/heads/master: d9b08b9efece1f397143378938e626d0de29e911
32 changes: 1 addition & 31 deletions trunk/fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1419,36 +1419,6 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos,
return total ? total : ret;
}

static int ocfs2_check_iovec(const struct iovec *iov, size_t *counted,
unsigned long *nr_segs)
{
size_t ocount; /* original count */
unsigned long seg;

ocount = 0;
for (seg = 0; seg < *nr_segs; seg++) {
const struct iovec *iv = &iov[seg];

/*
* If any segment has a negative length, or the cumulative
* length ever wraps negative then return -EINVAL.
*/
ocount += iv->iov_len;
if (unlikely((ssize_t)(ocount|iv->iov_len) < 0))
return -EINVAL;
if (access_ok(VERIFY_READ, iv->iov_base, iv->iov_len))
continue;
if (seg == 0)
return -EFAULT;
*nr_segs = seg;
ocount -= iv->iov_len; /* This segment is no good */
break;
}

*counted = ocount;
return 0;
}

static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
const struct iovec *iov,
unsigned long nr_segs,
Expand All @@ -1471,7 +1441,7 @@ static ssize_t ocfs2_file_aio_write(struct kiocb *iocb,
if (iocb->ki_left == 0)
return 0;

ret = ocfs2_check_iovec(iov, &ocount, &nr_segs);
ret = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ);
if (ret)
return ret;

Expand Down

0 comments on commit b8025e1

Please sign in to comment.