From d184b96cb8d5bd26fcef718acc447eb55f10ed08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Sat, 6 May 2017 14:54:33 -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_condition_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/condition.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/common/condition.c b/src/common/condition.c index 0b184422a..ceab81eab 100644 --- a/src/common/condition.c +++ b/src/common/condition.c @@ -66,14 +66,15 @@ ssize_t lttng_condition_serialize(const struct lttng_condition *condition, char *buf) { ssize_t ret, condition_size; - struct lttng_condition_comm condition_comm; + struct lttng_condition_comm condition_comm = { + .condition_type = (int8_t) condition->type + }; if (!condition) { ret = -1; goto end; } - condition_comm.condition_type = (int8_t) condition->type; ret = sizeof(struct lttng_condition_comm); if (buf) { memcpy(buf, &condition_comm, ret); -- 2.34.1