Found by Coverity:
CID
1090602 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking "stream" suggests that it may be null,
but it has already been dereferenced on all paths leading to the check
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
uint64_t *timestamp_begin)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *timestamp_begin)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !timestamp_begin)
return -EINVAL;
if (!stream || !timestamp_begin)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
uint64_t *timestamp_end)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *timestamp_end)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !timestamp_end)
return -EINVAL;
if (!stream || !timestamp_end)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
uint64_t *events_discarded)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *events_discarded)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !events_discarded)
return -EINVAL;
if (!stream || !events_discarded)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
uint64_t *content_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *content_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !content_size)
return -EINVAL;
if (!stream || !content_size)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
uint64_t *packet_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *packet_size)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !packet_size)
return -EINVAL;
if (!stream || !packet_size)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
uint64_t *stream_id)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *stream_id)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !stream_id)
return -EINVAL;
if (!stream || !stream_id)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb)
return -ENOSYS;
uint64_t *ts)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
uint64_t *ts)
{
struct lttng_ust_client_lib_ring_buffer_client_cb *client_cb;
- struct lttng_ust_lib_ring_buffer *buf = stream->buf;
- struct lttng_ust_shm_handle *handle = stream->chan->chan->handle;
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct lttng_ust_shm_handle *handle;
if (!stream || !ts)
return -EINVAL;
if (!stream || !ts)
return -EINVAL;
+ buf = stream->buf;
+ handle = stream->chan->chan->handle;
client_cb = get_client_cb(buf, handle);
if (!client_cb || !client_cb->current_timestamp)
return -ENOSYS;
client_cb = get_client_cb(buf, handle);
if (!client_cb || !client_cb->current_timestamp)
return -ENOSYS;