Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

[PATCH] ocfs2: use generic_segment_checks

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Mark Fasheh <mark.fasheh@oracle.com>

authored by

Christoph Hellwig and committed by
Mark Fasheh
d9b08b9e 8fccfc82

+1 -31
+1 -31
fs/ocfs2/file.c
··· 1419 1419 return total ? total : ret; 1420 1420 } 1421 1421 1422 - static int ocfs2_check_iovec(const struct iovec *iov, size_t *counted, 1423 - unsigned long *nr_segs) 1424 - { 1425 - size_t ocount; /* original count */ 1426 - unsigned long seg; 1427 - 1428 - ocount = 0; 1429 - for (seg = 0; seg < *nr_segs; seg++) { 1430 - const struct iovec *iv = &iov[seg]; 1431 - 1432 - /* 1433 - * If any segment has a negative length, or the cumulative 1434 - * length ever wraps negative then return -EINVAL. 1435 - */ 1436 - ocount += iv->iov_len; 1437 - if (unlikely((ssize_t)(ocount|iv->iov_len) < 0)) 1438 - return -EINVAL; 1439 - if (access_ok(VERIFY_READ, iv->iov_base, iv->iov_len)) 1440 - continue; 1441 - if (seg == 0) 1442 - return -EFAULT; 1443 - *nr_segs = seg; 1444 - ocount -= iv->iov_len; /* This segment is no good */ 1445 - break; 1446 - } 1447 - 1448 - *counted = ocount; 1449 - return 0; 1450 - } 1451 - 1452 1422 static ssize_t ocfs2_file_aio_write(struct kiocb *iocb, 1453 1423 const struct iovec *iov, 1454 1424 unsigned long nr_segs, ··· 1441 1471 if (iocb->ki_left == 0) 1442 1472 return 0; 1443 1473 1444 - ret = ocfs2_check_iovec(iov, &ocount, &nr_segs); 1474 + ret = generic_segment_checks(iov, &nr_segs, &ocount, VERIFY_READ); 1445 1475 if (ret) 1446 1476 return ret; 1447 1477