From f4855b46cb97a7ad649e97232719c50ab8688119 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 22 Sep 2014 15:30:51 -0400 Subject: [PATCH] Fix: syscall_list_show NULL pointer deref Also make sure the syscall listing index matches the bitmask. Signed-off-by: Mathieu Desnoyers --- lttng-syscalls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lttng-syscalls.c b/lttng-syscalls.c index 96d90c58..4eae6747 100644 --- a/lttng-syscalls.c +++ b/lttng-syscalls.c @@ -1152,8 +1152,11 @@ int syscall_list_show(struct seq_file *m, void *p) ret = get_sc_table(entry, &table, &bitness); if (ret) return ret; + if (!entry->desc) + return 0; seq_printf(m, "syscall { index = %lu; name = %s; bitness = %u; };\n", - entry - table, + table == sc_table ? entry - table : + (entry - table) + ARRAY_SIZE(sc_table), entry->desc->name, bitness); return 0; -- 2.34.1