diff options
-rw-r--r-- | cpukit/ChangeLog | 7 | ||||
-rw-r--r-- | cpukit/libcsupport/src/readv.c | 9 | ||||
-rw-r--r-- | cpukit/libcsupport/src/writev.c | 9 |
3 files changed, 17 insertions, 8 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 6a56a8e09a..e7002d1789 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,12 @@ 2010-08-25 Joel Sherrill <joel.sherrill@oarcorp.com> + Coverity Id 93/NO_EFFECT + Coverity Id 94/NO_EFFECT + * libcsupport/src/readv.c, libcsupport/src/writev.c: size_t is unsigned + so it is useless to check for < 0. + +2010-08-25 Joel Sherrill <joel.sherrill@oarcorp.com> + Coverity Id 125 Coverity Id 126 * libi2c/libi2c.c: Use strncpy and snprintf. diff --git a/cpukit/libcsupport/src/readv.c b/cpukit/libcsupport/src/readv.c index 3f97b14f14..6b33760504 100644 --- a/cpukit/libcsupport/src/readv.c +++ b/cpukit/libcsupport/src/readv.c @@ -68,10 +68,11 @@ ssize_t readv( for ( total=0, v=0 ; v < iovcnt ; v++ ) { ssize_t old; - if ( !iov[v].iov_base ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - if ( iov[v].iov_len < 0 ) + /* + * iov[v].iov_len cannot be less than 0 because size_t is unsigned. + * So we only check for zero. + */ + if ( iov[v].iov_base == 0 ) rtems_set_errno_and_return_minus_one( EINVAL ); /* check for wrap */ diff --git a/cpukit/libcsupport/src/writev.c b/cpukit/libcsupport/src/writev.c index 8dabe1d598..380e325365 100644 --- a/cpukit/libcsupport/src/writev.c +++ b/cpukit/libcsupport/src/writev.c @@ -73,10 +73,11 @@ ssize_t writev( all_zeros = true; for ( old=0, total=0, v=0 ; v < iovcnt ; v++ ) { - if ( !iov[v].iov_base ) - rtems_set_errno_and_return_minus_one( EINVAL ); - - if ( iov[v].iov_len < 0 ) + /* + * iov[v].iov_len cannot be less than 0 because size_t is unsigned. + * So we only check for zero. + */ + if ( iov[v].iov_base == 0 ) rtems_set_errno_and_return_minus_one( EINVAL ); if ( iov[v].iov_len ) |