From: Jérémie Galarneau Date: Wed, 7 Jun 2023 20:57:37 +0000 (-0400) Subject: common: silence bogus coverity warning X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=29784e2373ff4d82370f584f4e4e9722cda172a8;p=lttng-tools.git common: silence bogus coverity warning 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 --- 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;