]> git.ipfire.org Git - thirdparty/linux.git/commit
tracing: Fix trace_buf_size= cmdline parameter with sizes >= 2G
authorCalvin Owens <calvin@wbinvd.org>
Sat, 7 Mar 2026 03:19:25 +0000 (19:19 -0800)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Sat, 7 Mar 2026 03:25:53 +0000 (22:25 -0500)
commitd008ba8be8984760e36d7dcd4adbd5a41a645708
tree7d750a03480a14e5f2da40b54e9def19d741c2b7
parent3b1679e086bb869ca02722f6bd29b3573a6a0e7e
tracing: Fix trace_buf_size= cmdline parameter with sizes >= 2G

Some of the sizing logic through tracer_alloc_buffers() uses int
internally, causing unexpected behavior if the user passes a value that
does not fit in an int (on my x86 machine, the result is uselessly tiny
buffers).

Fix by plumbing the parameter's real type (unsigned long) through to the
ring buffer allocation functions, which already use unsigned long.

It has always been possible to create larger ring buffers via the sysfs
interface: this only affects the cmdline parameter.

Cc: stable@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://patch.msgid.link/bff42a4288aada08bdf74da3f5b67a2c28b761f8.1772852067.git.calvin@wbinvd.org
Fixes: 73c5162aa362 ("tracing: keep ring buffer to minimum size till used")
Signed-off-by: Calvin Owens <calvin@wbinvd.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace.c