From: Mathieu Desnoyers Date: Fri, 23 Sep 2011 16:31:59 +0000 (-0400) Subject: Check for num cpus X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=e095d8031307428069e549360284388e06683293;p=ust.git Check for num cpus Signed-off-by: Mathieu Desnoyers --- diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index 5e6d4df..0b4b89f 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -643,6 +643,8 @@ struct lib_ring_buffer *channel_get_ring_buffer( memory_map_size); return shmp(handle, chan->backend.buf[0].shmp); } else { + if (cpu >= num_possible_cpus()) + return NULL; ref = &chan->backend.buf[cpu].shmp._ref; shm_get_object_data(handle, ref, shm_fd, wait_fd, memory_map_size);