From 29784e2373ff4d82370f584f4e4e9722cda172a8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Wed, 7 Jun 2023 16:57:37 -0400 Subject: [PATCH] common: silence bogus coverity warning MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Coverity reports: 1512891 Uninitialized scalar variable The variable will contain an arbitrary value left from earlier computations. In lttng_event_serialize(lttng_event const *, unsigned int, char const * const *, char const *, unsigned long, lttng_bytecode *, lttng_payload *): Use of an uninitialized variable (CWE-457) This warning is bogus since lttng_event_exclusion_comm contains a single field which is already initialized and is packed (no padding possible). Initialize the header explicitly to silence the warning. Reported-by: Coverity Scan Signed-off-by: Jérémie Galarneau Change-Id: Ia1eeee779168b3ac0eb9d0796d503b2d9ab225f2 --- src/common/event.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/event.cpp b/src/common/event.cpp index dfcc52bc5..a6d48eaf7 100644 --- a/src/common/event.cpp +++ b/src/common/event.cpp @@ -736,7 +736,7 @@ int lttng_event_serialize(const struct lttng_event *event, for (i = 0; i < exclusion_count; i++) { const size_t exclusion_len = lttng_strnlen(*(exclusion_list + i), LTTNG_SYMBOL_NAME_LEN); - struct lttng_event_exclusion_comm exclusion_header; + struct lttng_event_exclusion_comm exclusion_header = {}; exclusion_header.len = (uint32_t) exclusion_len + 1; -- 2.34.1