Fix: _lttng_kernel_event_create never returns NULL
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 5 Nov 2021 19:08:07 +0000 (15:08 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 5 Nov 2021 19:08:07 +0000 (15:08 -0400)
Handle _lttng_kernel_event_create return value as IS_ERR. It is never
NULL.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Iaae2b632b7a11084403740c1849fe101bdca2472

src/lttng-abi.c
src/lttng-events.c
src/lttng-syscalls.c

index cd9466568221f3427ebad590f140b137251f32f0..c0ab0a488d7cade60defda6404badfc2e7061059 100644 (file)
@@ -1926,7 +1926,7 @@ int lttng_abi_create_event(struct file *channel_file,
                 * will stay invariant for the rest of the session.
                 */
                event = lttng_kernel_event_create(&event_enabler->parent, NULL);
-               WARN_ON_ONCE(!event);
+               WARN_ON_ONCE(IS_ERR(event));
                lttng_event_enabler_destroy(&event_enabler->parent);
                if (IS_ERR(event)) {
                        ret = PTR_ERR(event);
@@ -2163,7 +2163,7 @@ int lttng_abi_create_event_notifier(struct file *event_notifier_group_file,
                        goto event_notifier_error;
                }
                event = lttng_kernel_event_create(&event_notifier_enabler->parent, NULL);
-               WARN_ON_ONCE(!event);
+               WARN_ON_ONCE(IS_ERR(event));
                lttng_event_enabler_destroy(&event_notifier_enabler->parent);
                if (IS_ERR(event)) {
                        ret = PTR_ERR(event);
index b787b95c25f0fcfb1600ea81bc06b9e370add4e0..d3532b3dfc13e7c42378177be040f174c0b9d3f0 100644 (file)
@@ -2103,7 +2103,7 @@ void lttng_event_enabler_create_tracepoint_events_if_missing(struct lttng_event_
                         * We need to create an event for this event probe.
                         */
                        event = _lttng_kernel_event_create(event_enabler, desc);
-                       if (!event) {
+                       if (IS_ERR(event)) {
                                printk(KERN_INFO "LTTng: Unable to create event %s\n",
                                        probe_desc->event_desc[i]->event_name);
                        }
index e432da0d80ae1d24e15a029aa7248250e9562264..2e8324133d53ed069ec325bd29fd958ca6360d28 100644 (file)
@@ -568,9 +568,9 @@ void lttng_syscall_event_enabler_create_event(struct lttng_event_enabler_common
                if (!event_recorder_enabler)
                        return;
                event = _lttng_kernel_event_create(&event_recorder_enabler->parent, desc);
-               WARN_ON_ONCE(!event || IS_ERR(event));
+               WARN_ON_ONCE(IS_ERR(event));
                lttng_event_enabler_destroy(&event_recorder_enabler->parent);
-               if (!event || IS_ERR(event)) {
+               if (IS_ERR(event)) {
                        printk(KERN_INFO "Unable to create event recorder %s\n", desc->event_name);
                        return;
                }
@@ -618,9 +618,9 @@ void lttng_syscall_event_enabler_create_event(struct lttng_event_enabler_common
                                &event_notifier_param, syscall_event_notifier_enabler->group);
                WARN_ON_ONCE(!event_notifier_enabler);
                event = _lttng_kernel_event_create(&event_notifier_enabler->parent, desc);
-               WARN_ON_ONCE(!event || IS_ERR(event));
+               WARN_ON_ONCE(IS_ERR(event));
                lttng_event_enabler_destroy(&event_notifier_enabler->parent);
-               if (!event || IS_ERR(event)) {
+               if (IS_ERR(event)) {
                        printk(KERN_INFO "Unable to create event notifier %s\n", desc->event_name);
                        return;
                }
This page took 0.029331 seconds and 4 git commands to generate.