On Thu, 7 Aug 2025 18:52:56 +0300
Dan Carpenter <[email protected]> wrote:
> Hello Steven Rostedt,
>
> Commit e6187007d6c3 ("tracing/events: add startup tests for events")
> from Apr 15, 2009 (linux-next), leads to the following Smatch static
> checker warning:
So this "bug" is in a selftest that has been running fine since 2009.
Yes, if things go really bad then kthread_run() could return an error, and
if it does, it means the system is having major issues at boot up.
>
> kernel/trace/trace_events.c:4704 event_test_stuff()
> error: 'test_thread' dereferencing possible ERR_PTR()
>
> kernel/trace/trace_events.c
> 4698 static __init void event_test_stuff(void)
> 4699 {
> 4700 struct task_struct *test_thread;
> 4701
> 4702 test_thread = kthread_run(event_test_thread, NULL,
> "test-events");
> 4703 msleep(1);
> --> 4704 kthread_stop(test_thread);
>
> Check for if (!IS_ERR(test_thread)) ?
I'm not against taking a patch that adds a check, but I don't plan on
updating it myself.
static __init void event_test_stuff(void)
{
struct task_struct *test_thread;
test_thread = kthread_run(event_test_thread, NULL, "test-events");
if (WARN_ON_ONCE(IS_ERR(test_thread)))
return;
msleep(1);
kthread_stop(test_thread);
}
Would work for me.
-- Steve
>
> 4705 }
>
> regards,
> dan carpenter