ring-buffer: report header_page overwrite as signed char
Subsystems (2)
PATCH 1/1 ring-buffer: report header_page overwrite as signed char
The header_page tracefs metadata currently reports overwrite as an int field with size 1. That makes parsers warn about a type and size mismatch even though the field is only used as a one-byte flag within commit.
Keep the shared offset with commit as-is, but report overwrite as signed char so the declared type matches the hardcoded size and the emitted signedness.
--- kernel/trace/ring_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer.c +2 -2
@@ -627,11 +627,11 @@ int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq (unsigned int )sizeof (field.commit), (unsigned int)is_signed_type(long)); -trace_seq_printf (s,"\tfield: int overwrite;\t" +trace_seq_printf (s,"\tfield: signed char overwrite;\t" "offset:%u;\tsize:%u;\tsigned:%u;\n" , (unsigned int )offsetof(typeof (field ), commit),1 , - (unsigned int )is_signed_type (long)); + (unsigned int)is_signed_type(signed char)); trace_seq_printf(s, "\tfield: char data;\t" "offset:%u;\tsize:%u;\tsigned:%u;\n",
Signature · 1 line
2.39.5 (Apple Git-154)
Steven Rostedt
maintainerQuoted 20 lines · On Tue, 7 Apr 2026 00:28:43 +0800 CaoRuichuang <[email protected]> wrote:
The
header_pagetracefs metadata currently reports overwrite as an int field with size 1. That makes parsers warn about a type and size mismatch even though the field is only used as a one-byte flag within commit.Keep the shared offset with commit as-is, but report overwrite as signed char so the declared type matches the hardcoded size and the emitted signedness.
Signed-off-by CaoRuichuang <[email protected]>--- kernel/trace/ring_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)kernel/trace/ring_buffer.c +0
-0
kernel/trace/ring_buffer.c int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq · line 630
Quoted 5 lines
kernel/trace/ring_buffer.c +1
-1@@ -627,11 +627,11 @@ int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq (unsigned int )sizeof (field.commit), (unsigned int)is_signed_type(long)); - trace_seq_printf(s, "\tfield: int overwrite;\t" + trace_seq_printf(s, "\tfield: signed char overwrite;\t"
From the Bugzilla, the issue was with the rust parser. Would this still not cause a warning if the "int" was switched to "char" and not "signed char". The signed is redundant as it is already specified in the fields.
-- Steve
Quoted 8 lines
kernel/trace/ring_buffer.c +1
-1"offset:%u;\tsize:%u;\tsigned:%u;\n" , (unsigned int )offsetof(typeof (field ), commit),1 , - (unsigned int)is_signed_type(long)); + (unsigned int)is_signed_type(signed char)); trace_seq_printf(s, "\tfield: char data;\t" "offset:%u;\tsize:%u;\tsigned:%u;\n",
PATCH v2 1/1 ring-buffer: report header_page overwrite as char
In reply to CaoRuichuangThe header_page tracefs metadata currently reports overwrite as an int field with size 1. That makes parsers warn about a type and size mismatch even though the field is only used as a one-byte flag within commit.
Keep the shared offset with commit as-is, but report overwrite as char so the declared type matches the hardcoded size. The signedness is already carried separately by the emitted signed field.
--- kernel/trace/ring_buffer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/ring_buffer.c +2 -2
@@ -627,11 +627,11 @@ int ring_buffer_print_page_header(struct trace_buffer *buffer, struct trace_seq (unsigned int )sizeof (field.commit), (unsigned int)is_signed_type(long)); -trace_seq_printf (s,"\tfield: int overwrite;\t" +trace_seq_printf (s,"\tfield: char overwrite;\t" "offset:%u;\tsize:%u;\tsigned:%u;\n" , (unsigned int )offsetof(typeof (field ), commit),1 , - (unsigned int )is_signed_type (long)); + (unsigned int )is_signed_type (char)); trace_seq_printf(s, "\tfield: char data;\t" "offset:%u;\tsize:%u;\tsigned:%u;\n",
Signature · 1 line
2.39.5 (Apple Git-154)