From 2f566a887f7803f546abe1e44456ae8314ffec08 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 19 Jul 2024 20:38:29 +0000 Subject: [PATCH] Fix: relayd: incorrect use of lfht add_unique API MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit cds_lfht_add_unique is misused in relay_index_add_unique. The address of the node is used instead of the address of the key for both the key parameter and to compute the hash of the index entry's key. This caused problems in an upcoming change that changes the layout of the lttng_ht node since the key is no longer the first member of the node. Change-Id: Iec67f78b8ced4f4e520dc0dbebda8d30e283aa38 Signed-off-by: Jérémie Galarneau --- src/bin/lttng-relayd/index.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/lttng-relayd/index.cpp b/src/bin/lttng-relayd/index.cpp index e47f647f1..87ed2d5d2 100644 --- a/src/bin/lttng-relayd/index.cpp +++ b/src/bin/lttng-relayd/index.cpp @@ -75,9 +75,9 @@ static struct relay_index *relay_index_add_unique(struct relay_stream *stream, index->index_n.key); node_ptr = cds_lfht_add_unique(stream->indexes_ht->ht, - stream->indexes_ht->hash_fct(&index->index_n, lttng_ht_seed), + stream->indexes_ht->hash_fct(&index->index_n.key, lttng_ht_seed), stream->indexes_ht->match_fct, - &index->index_n, + &index->index_n.key, &index->index_n.node); if (node_ptr != &index->index_n.node) { _index = caa_container_of(node_ptr, struct relay_index, index_n.node); -- 2.34.1