From c4d6bd104a561c94c35147ae34d5810ca9f05740 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 30 Nov 2013 11:47:05 +0100 Subject: [PATCH] Fix: client_packet_header() uses wrong packet It should use lib_ring_buffer_read_offset_address() to get the packet being read, rather than lib_ring_buffer_offset_address(), which is only meant to be used when writing to the packet. Signed-off-by: Mathieu Desnoyers --- liblttng-ust/lttng-ring-buffer-client.h | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/liblttng-ust/lttng-ring-buffer-client.h b/liblttng-ust/lttng-ring-buffer-client.h index 2cdecbe9..87d1a8cd 100644 --- a/liblttng-ust/lttng-ring-buffer-client.h +++ b/liblttng-ust/lttng-ring-buffer-client.h @@ -389,19 +389,7 @@ static void client_buffer_finalize(struct lttng_ust_lib_ring_buffer *buf, void * static struct packet_header *client_packet_header(struct lttng_ust_lib_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { - struct channel *chan = shmp(handle, buf->backend.chan); - struct lttng_channel *lttng_chan = channel_get_private(chan); - unsigned long sb_index; - struct lttng_ust_lib_ring_buffer_backend *bufb; - struct packet_header *header; - - bufb = &buf->backend; - sb_index = subbuffer_id_get_index(<tng_chan->chan->backend.config, - bufb->buf_rsb.id); - header = lib_ring_buffer_offset_address(bufb, - sb_index * lttng_chan->chan->backend.subbuf_size, - handle); - return header; + return lib_ring_buffer_read_offset_address(&buf->backend, 0, handle); } static int client_timestamp_begin(struct lttng_ust_lib_ring_buffer *buf, -- 2.34.1