linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bug report] tracing/events: add startup tests for events
@ 2025-08-07 15:52 Dan Carpenter
  2025-08-13 15:34 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-08-07 15:52 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-kernel

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:

	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)) ?

    4705 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] tracing/events: add startup tests for events
  2025-08-07 15:52 [bug report] tracing/events: add startup tests for events Dan Carpenter
@ 2025-08-13 15:34 ` Steven Rostedt
  0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2025-08-13 15:34 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Steven Rostedt, linux-trace-kernel

On Thu, 7 Aug 2025 18:52:56 +0300
Dan Carpenter <dan.carpenter@linaro.org> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-13 15:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-07 15:52 [bug report] tracing/events: add startup tests for events Dan Carpenter
2025-08-13 15:34 ` Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).