You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by bc...@apache.org on 2017/05/09 18:01:40 UTC

[trafficserver] branch master updated: coverity 1021768: Uninitialized pointer field

This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

The following commit(s) were added to refs/heads/master by this push:
       new  6dfb0cb   coverity 1021768: Uninitialized pointer field
6dfb0cb is described below

commit 6dfb0cb304ff0f0f15f464ab7206bd312be30b15
Author: Bryan Call <bc...@apache.org>
AuthorDate: Tue May 9 11:40:53 2017 -0400

    coverity 1021768: Uninitialized pointer field
---
 iocore/aio/AIO.cc  |  2 +-
 iocore/aio/I_AIO.h | 30 +++++++++++++++---------------
 2 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/iocore/aio/AIO.cc b/iocore/aio/AIO.cc
index b5a8239..e3cf06d 100644
--- a/iocore/aio/AIO.cc
+++ b/iocore/aio/AIO.cc
@@ -401,7 +401,7 @@ cache_op(AIOCallbackInternal *op)
 {
   bool read = (op->aiocb.aio_lio_opcode == LIO_READ);
   for (; op; op = (AIOCallbackInternal *)op->then) {
-    ink_aiocb_t *a = &op->aiocb;
+    ink_aiocb *a = &op->aiocb;
     ssize_t err, res = 0;
 
     while (a->aio_nbytes - res > 0) {
diff --git a/iocore/aio/I_AIO.h b/iocore/aio/I_AIO.h
index c685d3c..e1a87e1 100644
--- a/iocore/aio/I_AIO.h
+++ b/iocore/aio/I_AIO.h
@@ -59,7 +59,7 @@
 
 #define MAX_AIO_EVENTS 1024
 
-typedef struct iocb ink_aiocb_t;
+typedef struct iocb ink_aiocb;
 typedef struct io_event ink_io_event_t;
 
 // XXX hokey old-school compatibility with ink_aiocb.h ...
@@ -69,17 +69,17 @@ typedef struct io_event ink_io_event_t;
 
 #else
 
-typedef struct ink_aiocb {
-  int aio_fildes;
-  volatile void *aio_buf; /* buffer location */
-  size_t aio_nbytes;      /* length of transfer */
-  off_t aio_offset;       /* file offset */
+struct ink_aiocb {
+  int aio_fildes         = 0;
+  volatile void *aio_buf = nullptr; /* buffer location */
+  size_t aio_nbytes      = 0;       /* length of transfer */
+  off_t aio_offset       = 0;       /* file offset */
 
-  int aio_reqprio;    /* request priority offset */
-  int aio_lio_opcode; /* listio operation */
-  int aio_state;      /* state flag for List I/O */
-  int aio__pad[1];    /* extension padding */
-} ink_aiocb_t;
+  int aio_reqprio    = 0; /* request priority offset */
+  int aio_lio_opcode = 0; /* listio operation */
+  int aio_state      = 0; /* state flag for List I/O */
+  int aio__pad[1];        /* extension padding */
+};
 
 bool ink_aio_thread_num_set(int thread_num);
 
@@ -94,12 +94,12 @@ bool ink_aio_thread_num_set(int thread_num);
 
 struct AIOCallback : public Continuation {
   // set before calling aio_read/aio_write
-  ink_aiocb_t aiocb;
+  ink_aiocb aiocb;
   Action action;
-  EThread *thread;
-  AIOCallback *then;
+  EThread *thread   = nullptr;
+  AIOCallback *then = nullptr;
   // set on return from aio_read/aio_write
-  int64_t aio_result;
+  int64_t aio_result = 0;
 
   int ok();
   AIOCallback() : thread(AIO_CALLBACK_THREAD_ANY), then(0) { aiocb.aio_reqprio = AIO_DEFAULT_PRIORITY; }

-- 
To stop receiving notification emails like this one, please contact
['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].