diff mbox series

[lttng-tools] Initialize ret to zero

Message ID 20180430182735.12118-1-jonathan.rajotte-julien@efficios.com
State Accepted, archived
Delegated to: Jérémie Galarneau
Headers show
Series [lttng-tools] Initialize ret to zero | expand

Commit Message

Jonathan Rajotte April 30, 2018, 6:27 p.m. UTC
sample_channel_positions return garbage if cds_lfht_is_node_deleted(&stream->node.node)
on first and "possibly" only iteration of the consumer_data.stream_per_chan_id_ht
hash table.

Found by scan-build

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
---
 src/common/consumer/consumer-timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jérémie Galarneau May 2, 2018, 2:25 p.m. UTC | #1
Merged, thanks!

Jérémie

On 30 April 2018 at 14:27, Jonathan Rajotte <
jonathan.rajotte-julien at efficios.com> wrote:

> sample_channel_positions return garbage if cds_lfht_is_node_deleted(&
> stream->node.node)
> on first and "possibly" only iteration of the
> consumer_data.stream_per_chan_id_ht
> hash table.
>
> Found by scan-build
>
> Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien at efficios.com>
> ---
>  src/common/consumer/consumer-timer.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/common/consumer/consumer-timer.c b/src/common/consumer/
> consumer-timer.c
> index 721f146e..38b8b30d 100644
> --- a/src/common/consumer/consumer-timer.c
> +++ b/src/common/consumer/consumer-timer.c
> @@ -637,7 +637,7 @@ int sample_channel_positions(struct
> lttng_consumer_channel *channel,
>                 sample_positions_cb sample, get_consumed_cb get_consumed,
>                 get_produced_cb get_produced)
>  {
> -       int ret;
> +       int ret = 0;
>         struct lttng_ht_iter iter;
>         struct lttng_consumer_stream *stream;
>         bool empty_channel = true;
> --
> 2.17.0
>
>
diff mbox series

Patch

diff --git a/src/common/consumer/consumer-timer.c b/src/common/consumer/consumer-timer.c
index 721f146e..38b8b30d 100644
--- a/src/common/consumer/consumer-timer.c
+++ b/src/common/consumer/consumer-timer.c
@@ -637,7 +637,7 @@  int sample_channel_positions(struct lttng_consumer_channel *channel,
 		sample_positions_cb sample, get_consumed_cb get_consumed,
 		get_produced_cb get_produced)
 {
-	int ret;
+	int ret = 0;
 	struct lttng_ht_iter iter;
 	struct lttng_consumer_stream *stream;
 	bool empty_channel = true;