From 93c2f02399d2c9fad48acfcea5f4f9ef508a9493 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 10 Feb 2011 16:11:02 -0500 Subject: [PATCH] type-serializer: check is cpu id is out of bound. Signed-off-by: Mathieu Desnoyers --- libust/type-serializer.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libust/type-serializer.c b/libust/type-serializer.c index 2c278df..dcaea1e 100644 --- a/libust/type-serializer.c +++ b/libust/type-serializer.c @@ -82,6 +82,14 @@ void _ltt_specialized_trace(const struct marker *mdata, void *probe_data, if (!chan->active) continue; + /* If a new cpu was plugged since the trace was started, we did + * not add it to the trace, and therefore we write the event to + * cpu 0. + */ + if(cpu >= chan->n_cpus) { + cpu = 0; + } + /* reserve space : header and data */ ret = ltt_reserve_slot(chan, trace, data_size, largest_align, cpu, &buf, &slot_size, &buf_offset, &tsc, -- 2.34.1