kconsumer: clean-up: initialize ctf_index before populating it
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 15 Sep 2019 18:56:23 +0000 (14:56 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 15 Sep 2019 18:56:23 +0000 (14:56 -0400)
The 'offset' field of the ctf_index is used uninitialized when it is
populated. Its uninitialized value is read and stored back.  This is
not a problem as the offset is populated later-on.

Coveity reports
1405630 Uninitialized scalar variable
The variable will contain an arbitrary value left from earlier computations.
In lttng_kconsumer_read_subbuffer: Use of an uninitialized variable (CWE-457)

Reported-by: Coverity Scan
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/kernel-consumer/kernel-consumer.c

index aea1b4831d158da0052d0533d1dc9279096a1eca..9fa92f6b80d190ff1d3202e03e8d9d8e110ff4ae 100644 (file)
@@ -1553,7 +1553,7 @@ ssize_t lttng_kconsumer_read_subbuffer(struct lttng_consumer_stream *stream,
        int err, write_index = 1, rotation_ret;
        ssize_t ret = 0;
        int infd = stream->wait_fd;
-       struct ctf_packet_index index;
+       struct ctf_packet_index index = {};
 
        DBG("In read_subbuffer (infd : %d)", infd);
 
This page took 0.026278 seconds and 4 git commands to generate.