tracing: Check the return value of tracing_update_buffers()
Steven Rostedt
maintainerPATCH 1/1 tracing: Check the return value of tracing_update_buffers()
From: Steven Rostedt <[email protected]>
In the very unlikely event that tracing_update_buffers() fails in trace_printk_init_buffers(), report the failure so that it is known.
Suggested-by Li Zhong <[email protected]>
Signed-off-by Steven Rostedt (Google) <[email protected]>
--- kernel/trace/trace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/trace/trace.c +4 -3
@@ -3418,9 +3418,10 @@ void trace_printk_init_buffers(void)pr_warn ("**********************************************************\n" );/* Expand the buffers to set size */ -tracing_update_buffers (&global_trace); - - buffers_allocated =1 ; +if (tracing_update_buffers (&global_trace) <0 ) +pr_err ("Failed to expand tracing buffers for trace_printk() calls\n" ); +else + buffers_allocated =1 ;/* * trace_printk_init_buffers() can be called by modules.
Signature · 1 line
2.51.0
Quoted 6 lines · On Wed, 7 Jan 2026 16:15:10 -0500 Steven Rostedt <[email protected]> wrote:
From: Steven Rostedt <[email protected]>
In the very unlikely event that
tracing_update_buffers()fails intrace_printk_init_buffers(), report the failure so that it is known.
Good catch! Looks good to me.
Thanks,
Quoted 29 lines
Suggested-by Li Zhong <[email protected]>Signed-off-by Steven Rostedt (Google) <[email protected]>--- kernel/trace/trace.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)kernel/trace/trace.c +4
-3@@ -3418,9 +3418,10 @@ void trace_printk_init_buffers(void)pr_warn ("**********************************************************\n" );/* Expand the buffers to set size */ -tracing_update_buffers (&global_trace); - - buffers_allocated =1 ; +if (tracing_update_buffers (&global_trace) <0 ) +pr_err ("Failed to expand tracing buffers for trace_printk() calls\n" ); +else + buffers_allocated =1 ;/* * trace_printk_init_buffers() can be called by modules. Signature · 1 line
2.51.0
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>