Fix: increment buffer offset when failing to copy from user-space
[lttng-modules.git] / lttng-syscalls.c
index 26cead68252f336221b31a3e54c9f86aeb8cdf08..4596ccfc1280f82eaefdd0b5b6462bceffee0f8f 100644 (file)
@@ -81,7 +81,7 @@ struct timeval;
 struct itimerval;
 struct itimerspec;
 
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,6,0))
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
 typedef __kernel_old_time_t time_t;
 #endif
 
@@ -719,7 +719,7 @@ int fill_table(const struct trace_syscall_entry *table, size_t table_len,
                        ev.u.syscall.abi = LTTNG_KERNEL_SYSCALL_ABI_COMPAT;
                        break;
                }
-               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN);
+               strncpy(ev.name, desc->name, LTTNG_KERNEL_SYM_NAME_LEN - 1);
                ev.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
                ev.instrumentation = LTTNG_KERNEL_SYSCALL;
                chan_table[i] = _lttng_event_create(chan, &ev, filter,
@@ -1057,7 +1057,6 @@ int lttng_syscall_filter_enable(struct lttng_channel *chan,
        if (syscall_nr < 0)
                return -ENOENT;
 
-
        switch (event->u.syscall.entryexit) {
        case LTTNG_SYSCALL_ENTRY:
                switch (event->u.syscall.abi) {
@@ -1067,6 +1066,8 @@ int lttng_syscall_filter_enable(struct lttng_channel *chan,
                case LTTNG_SYSCALL_ABI_COMPAT:
                        bitmap = filter->sc_compat_entry;
                        break;
+               default:
+                       return -EINVAL;
                }
                break;
        case LTTNG_SYSCALL_EXIT:
@@ -1077,6 +1078,8 @@ int lttng_syscall_filter_enable(struct lttng_channel *chan,
                case LTTNG_SYSCALL_ABI_COMPAT:
                        bitmap = filter->sc_compat_exit;
                        break;
+               default:
+                       return -EINVAL;
                }
                break;
        default:
@@ -1113,7 +1116,6 @@ int lttng_syscall_filter_disable(struct lttng_channel *chan,
        if (syscall_nr < 0)
                return -ENOENT;
 
-
        switch (event->u.syscall.entryexit) {
        case LTTNG_SYSCALL_ENTRY:
                switch (event->u.syscall.abi) {
@@ -1123,6 +1125,8 @@ int lttng_syscall_filter_disable(struct lttng_channel *chan,
                case LTTNG_SYSCALL_ABI_COMPAT:
                        bitmap = filter->sc_compat_entry;
                        break;
+               default:
+                       return -EINVAL;
                }
                break;
        case LTTNG_SYSCALL_EXIT:
@@ -1133,6 +1137,8 @@ int lttng_syscall_filter_disable(struct lttng_channel *chan,
                case LTTNG_SYSCALL_ABI_COMPAT:
                        bitmap = filter->sc_compat_exit;
                        break;
+               default:
+                       return -EINVAL;
                }
                break;
        default:
This page took 0.024073 seconds and 4 git commands to generate.