[Libsysio-commit] HEAD: libsysio/src ioctx.c
Brought to you by:
lward
From: Lee W. <lw...@us...> - 2004-07-12 22:52:00
|
Update of /cvsroot/libsysio/libsysio/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3641/src Modified Files: ioctx.c Log Message: From Ruth; If, for list IO via {read,write}x an iovec entry was larger or same than a matched xtvec then _sysio_enumerate_extents would go one entry too far. We had forgotten to decrement the vector length in this case. Fixed. By inspection; When trying to satisfy an xtvec, we could deref a bad/invalid ptr. Fixed. Some cleanup to do with spacing and braces -- style stuff. Index: ioctx.c =================================================================== RCS file: /cvsroot/libsysio/libsysio/src/ioctx.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -w -b -B -p -r1.17 -r1.18 --- ioctx.c 3 Jul 2004 05:47:13 -0000 1.17 +++ ioctx.c 12 Jul 2004 22:51:51 -0000 1.18 @@ -385,9 +385,8 @@ _sysio_enumerate_extents(const struct in while (xtvec.xtv_len) { if (iovec.iov_len) { tmp = iovec.iov_len; - if (iovec.iov_len > xtvec.xtv_len) { + if (iovec.iov_len > xtvec.xtv_len) iovec.iov_len = xtvec.xtv_len; - } cc = (*f)(&iovec, 1, xtvec.xtv_off, @@ -404,7 +403,7 @@ _sysio_enumerate_extents(const struct in if (acc && tmp <= acc) abort(); /* paranoia */ acc = tmp; - } else { + } else if (iovlen) { start = iov; n = xtvec.xtv_len; do { @@ -419,18 +418,14 @@ _sysio_enumerate_extents(const struct in } while (--iovlen); if (iov == start) { iovec = *iov++; -#if 0 - if (iovec.iov_len > n) { - iovec.iov_len = n; - } -#endif + iovlen--; continue; } remain = xtvec.xtv_len - n; cc = (*f)(start, iov - start, xtvec.xtv_off, - xtvec.xtv_len - n, + remain, arg); if (cc <= 0) { if (acc) @@ -443,13 +438,11 @@ _sysio_enumerate_extents(const struct in abort(); /* paranoia */ acc = tmp; - if (remain && !iovlen) - return acc; - remain -= cc; if (remain) return acc; /* short */ - } + } else + return acc; /* short out */ xtvec.xtv_off += cc; xtvec.xtv_len -= cc; } |