Fix: relayd stream.c: LTTNG_OPTIONAL_GET address confusion
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 18 Dec 2019 15:56:29 +0000 (10:56 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 22:07:20 +0000 (17:07 -0500)
commitf3fe2a9216e46a1a10490e7457fabce7872bf5b7
tree58a80acbcca3295ad5583015c0b6109b307c531a
parentbc2dc8d464c34ad5a51ed46e46c6fc98a5bbf3fd
Fix: relayd stream.c: LTTNG_OPTIONAL_GET address confusion

The lack of proper care around use of macro arguments in LTTNG_OPTIONAL_GET
allowed this code to compile, but caused the following issue (manually
replacing "optional" argument with the a

Using LTTNG_OPTIONAL_GET(&stream->ongoing_rotation)->next_trace_chunk

with:

 #define LTTNG_OPTIONAL_GET(optional)                   \
         ({                                             \
               assert(optional.is_set);                 \
               optional.value;                          \
         })

translates to:

         ({
               assert(&stream->ongoing_rotation.is_set);
               &stream->ongoing_rotation.value;
         })->next_trace_chunk

The issue here is the assert(), which just checks that the address
is not NULL, when it should actually check that the value is set.

The prior commit fixing optional.h to add proper parentheses to the
macro rightfully fails to compile this code. Fix the erroneous user.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I0dd45fb60573cae6ae3e831e24266aff4406f57f
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/stream.c
This page took 0.033273 seconds and 4 git commands to generate.