X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust-ctl%2Fustctl.c;h=6b6f295b38bd81ff4ce3e26ad47f7ea37c351fc0;hb=fe1a364a4aec831bb6c9e57a75bdf44da5077884;hp=5801bc6b4b78e6b8c6b837d44755c79f1264f348;hpb=36e9db06696c38d75f1fd24f03772fc7309b667e;p=lttng-ust.git diff --git a/liblttng-ust-ctl/ustctl.c b/liblttng-ust-ctl/ustctl.c index 5801bc6b..6b6f295b 100644 --- a/liblttng-ust-ctl/ustctl.c +++ b/liblttng-ust-ctl/ustctl.c @@ -1341,6 +1341,8 @@ int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream, unsigned long sb_bindex; struct lttng_ust_lib_ring_buffer *buf; struct ustctl_consumer_channel *consumer_chan; + struct lttng_ust_lib_ring_buffer_backend_pages_shmp *barray_idx; + struct lttng_ust_lib_ring_buffer_backend_pages *pages; if (!stream) return -EINVAL; @@ -1351,8 +1353,14 @@ int ustctl_get_mmap_read_offset(struct ustctl_consumer_stream *stream, return -EINVAL; sb_bindex = subbuffer_id_get_index(&chan->backend.config, buf->backend.buf_rsb.id); - *off = shmp(consumer_chan->chan->handle, - shmp_index(consumer_chan->chan->handle, buf->backend.array, sb_bindex)->shmp)->mmap_offset; + barray_idx = shmp_index(consumer_chan->chan->handle, buf->backend.array, + sb_bindex); + if (!barray_idx) + return -EINVAL; + pages = shmp(consumer_chan->chan->handle, barray_idx->shmp); + if (!pages) + return -EINVAL; + *off = pages->mmap_offset; return 0; } @@ -1518,6 +1526,8 @@ struct lttng_ust_client_lib_ring_buffer_client_cb *get_client_cb( struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb; chan = shmp(handle, buf->backend.chan); + if (!chan) + return NULL; config = &chan->backend.config; if (!config->cb_ptr) return NULL;