libtracefs: Pass the pipe size by value to F_SETPIPE_SZ

F_SETPIPE_SZ takes the new size as the argument itself, but init_splice()
passes a pointer to it.  The kernel takes that argument as an unsigned int,
so the pointer is truncated to its low 32 bits and used as the size.  That
usually fails, leaving the pipe at the default 64K, so a sub buffer larger
than that no longer fits in one splice() and the recorders lose data.  It
can also succeed at an unrelated size with no error to notice.

Failing here stays non fatal, as an unprivileged caller cannot raise a pipe
above /proc/sys/fs/pipe-max-size and the default size still records.

While here, drop the third argument from the F_GETPIPE_SZ call next to it.
That command takes no argument and returns the size, so the pointer was
never read and the return value was already being used.  The branch it fed
was unreachable: F_GETPIPE_SZ never returns zero on success.

Link: https://lore.kernel.org/20261108054458.217842-1-lipengfei28@xiaomi.com
Fixes: e34cbd83f6d3 ("libtracefs: Increase splice to use pipe max size")
Signed-off-by: Li Pengfei <lipengfei28@xiaomi.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 file changed