diff options
author | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-01-19 23:54:17 +0000 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@OARcorp.com> | 2010-01-19 23:54:17 +0000 |
commit | a518defe922c91dc2af9f51e3694963364c247a9 (patch) | |
tree | b1d187f8fc0dba1d3e8e5b8a9fadf6b1bc95c58d /cpukit | |
parent | 2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com> (diff) | |
download | rtems-a518defe922c91dc2af9f51e3694963364c247a9.tar.bz2 |
2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com>
Coverity Id 10
* libblock/src/bdbuf.c: Rework loop conditional to avoid potential use
of NULL pointer.
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 6 | ||||
-rw-r--r-- | cpukit/libblock/src/bdbuf.c | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 75a0a171cb..f5c25c6dde 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,5 +1,11 @@ 2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com> + Coverity Id 10 + * libblock/src/bdbuf.c: Rework loop conditional to avoid potential use + of NULL pointer. + +2010-01-19 Joel Sherrill <joel.sherrill@oarcorp.com> + Coverity Id 23 * libmisc/monitor/mon-monitor.c: Add fclose() of file. diff --git a/cpukit/libblock/src/bdbuf.c b/cpukit/libblock/src/bdbuf.c index 2282f24417..056a7c8ec2 100644 --- a/cpukit/libblock/src/bdbuf.c +++ b/cpukit/libblock/src/bdbuf.c @@ -2253,6 +2253,7 @@ rtems_bdbuf_null_disk_ioctl (rtems_disk_device *dd, uint32_t req, void *arg) static void rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) { + rtems_chain_node *node; static rtems_disk_device null_disk = { .capabilities = 0, .ioctl = rtems_bdbuf_null_disk_ioctl @@ -2301,12 +2302,10 @@ rtems_bdbuf_swapout_write (rtems_bdbuf_swapout_transfer* transfer) transfer->write_req->status = RTEMS_RESOURCE_IN_USE; transfer->write_req->bufnum = 0; - while (!rtems_chain_is_empty (&transfer->bds)) + while ((node = rtems_chain_get(&transfer->bds)) != NULL) { - rtems_bdbuf_buffer* bd = - (rtems_bdbuf_buffer*) rtems_chain_get (&transfer->bds); - - bool write = false; + rtems_bdbuf_buffer* bd = (rtems_bdbuf_buffer*) node; + bool write = false; /* * If the device only accepts sequential buffers and this is not the |