Silence bogus Coverity warning of uninitialized value
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 6 May 2017 18:43:46 +0000 (14:43 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 6 May 2017 18:43:46 +0000 (14:43 -0400)
Coverity complains that struct lttng_evaluation_comm's payload
field is not initialized. "payload" is a flexible array
member which should be ignored. Normally, a such a member
_could_ result in additional padding added at the end of the
structure. In this case, the structure is declared as packed.

Nonetheless, using a designated initializer gets rid of the
ambiguity and silences Coverity.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/evaluation.c

index c6243d232e82690ab9ca4a39cea3ed4aff1de974..43b4e743f22e807dfd799201387ef40b4df755fc 100644 (file)
@@ -27,9 +27,10 @@ ssize_t lttng_evaluation_serialize(struct lttng_evaluation *evaluation,
                char *buf)
 {
        ssize_t ret, offset = 0;
-       struct lttng_evaluation_comm evaluation_comm;
+       struct lttng_evaluation_comm evaluation_comm = {
+               .type = (int8_t) evaluation->type
+       };
 
-       evaluation_comm.type = (int8_t) evaluation->type;
        if (buf) {
                memcpy(buf, &evaluation_comm, sizeof(evaluation_comm));
        }
This page took 0.026578 seconds and 5 git commands to generate.