From: Francis Deslauriers Date: Wed, 25 Nov 2020 15:25:54 +0000 (-0500) Subject: Fix: syscalls: address of statically allocated element never null X-Git-Tag: v2.13.0-rc1~108 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=d053f3eecd81fad0189e12f9f63a6095d421d5d8;p=lttng-modules.git Fix: syscalls: address of statically allocated element never null This check is intended to confirm that the table element for that syscall is indeed populated but checked that the element is NULL. This was never the case because the address of an element of a statically allocated array cannot be NULL. Fix this by check if the function pointer is NULL instead. This means that the element is not populated. Signed-off-by: Francis Deslauriers Signed-off-by: Mathieu Desnoyers Change-Id: I1d769d6609fa4517199f022e1a262c4494c8f63a --- diff --git a/src/lttng-syscalls.c b/src/lttng-syscalls.c index 3e9f791a..06d16ff2 100644 --- a/src/lttng-syscalls.c +++ b/src/lttng-syscalls.c @@ -522,7 +522,7 @@ void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id) return; } entry = &table[id]; - WARN_ON_ONCE(!entry); + WARN_ON_ONCE(!entry->event_func); syscall_entry_call_func(entry->event_func, entry->nrargs, event, regs); } @@ -584,7 +584,7 @@ void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret) return; } entry = &table[id]; - WARN_ON_ONCE(!entry); + WARN_ON_ONCE(!entry->event_func); switch (entry->nrargs) { case 0: