From: Mathieu Desnoyers Date: Sat, 30 Nov 2013 10:47:05 +0000 (+0100) Subject: Fix: client_packet_header() uses wrong packet X-Git-Tag: v2.4.0-rc2~9 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=c4d6bd104a561c94c35147ae34d5810ca9f05740;p=lttng-ust.git 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 --- 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,