From db315d7532d5b475e2fe1cf4e7b2d850196093fe Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 6 May 2017 14:43:46 -0400 Subject: [PATCH] Silence bogus Coverity warning of uninitialized value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/common/evaluation.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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)); } -- 2.34.1