From: Mathieu Desnoyers Date: Thu, 16 Oct 2014 14:50:56 +0000 (+0200) Subject: Fix: syscall listing of session X-Git-Tag: v2.6.0-rc1~4 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=2f25059db8c710589000120cfeea0983491b5547;p=lttng-modules.git Fix: syscall listing of session Fixes syscall listing of sessions when no syscall has been enabled. Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 5501997c..622da6e2 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -1230,13 +1230,31 @@ long lttng_channel_syscall_mask(struct lttng_channel *channel, filter = channel->sc_filter; for (bit = 0; bit < ARRAY_SIZE(sc_table); bit++) { - bt_bitfield_write_be(tmp_mask, char, bit, 1, - filter ? test_bit(bit, filter->sc) : 1); + bool state; + + if (channel->sc_table) { + if (filter) + state = test_bit(bit, filter->sc); + else + state = 1; + } else { + state = 0; + } + bt_bitfield_write_be(tmp_mask, char, bit, 1, state); } for (; bit < sc_tables_len; bit++) { - bt_bitfield_write_be(tmp_mask, char, bit, 1, - filter ? test_bit(bit - ARRAY_SIZE(sc_table), - filter->sc_compat) : 1); + bool state; + + if (channel->compat_sc_table) { + if (filter) + state = test_bit(bit - ARRAY_SIZE(sc_table), + filter->sc_compat); + else + state = 1; + } else { + state = 0; + } + bt_bitfield_write_be(tmp_mask, char, bit, 1, state); } if (copy_to_user(usyscall_mask->mask, tmp_mask, bitmask_len)) ret = -EFAULT;