From: Jérémie Galarneau Date: Sat, 6 May 2017 18:43:46 +0000 (-0400) Subject: Silence bogus Coverity warning of uninitialized value X-Git-Tag: v2.10.0-rc2~87 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b137f8756b6a89c9bdd1bc35f5f03332cbb395c2;p=lttng-tools.git Silence bogus Coverity warning of uninitialized value 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 --- diff --git a/src/common/evaluation.c b/src/common/evaluation.c index c6243d232..43b4e743f 100644 --- a/src/common/evaluation.c +++ b/src/common/evaluation.c @@ -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)); }