From: Valentin Schneider <vschneid@redhat.com>
To: linux-trace-devel@vger.kernel.org
Cc: Steven Rostedt <rostedt@goodmis.org>,
Daniel Bristot de Oliveira <bristot@redhat.com>,
Clark Williams <williams@redhat.com>,
Douglas RAILLARD <douglas.raillard@arm.com>
Subject: [PATCH v3 1/4] libtraceevent: Ensure print_field_raw() terminates with '\0'
Date: Tue, 13 Dec 2022 16:56:17 +0000 [thread overview]
Message-ID: <20221213165620.1034287-2-vschneid@redhat.com> (raw)
In-Reply-To: <20221213165620.1034287-1-vschneid@redhat.com>
Testing printing cpumasks reveals an issue in print_field_raw()'s handling
of arrays: its final operation is trace_seq_putc(']'), which omits a final
'\0'.
The other cases in the function invoke trace_seq_printf() which does the
right thing, only the TEP_FIELD_IS_ARRAY case has that issue. Still, to
prevent any future surprises, add a call to trace_seq_terminate() at the
end of print_field_raw().
Signed-off-by: Valentin Schneider <vschneid@redhat.com>
---
src/event-parse.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/event-parse.c b/src/event-parse.c
index a6e9e93..093b345 100644
--- a/src/event-parse.c
+++ b/src/event-parse.c
@@ -5681,6 +5681,7 @@ static void print_field_raw(struct trace_seq *s, void *data, int size,
trace_seq_printf(s, "%llu", val);
}
}
+ trace_seq_terminate(s);
}
static int print_parse_data(struct tep_print_parse *parse, struct trace_seq *s,
--
2.31.1
next prev parent reply other threads:[~2022-12-13 17:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-13 16:56 [PATCH v3 0/4] libtraceevent: Handling cpumask event fields Valentin Schneider
2022-12-13 16:56 ` Valentin Schneider [this message]
2022-12-13 16:56 ` [PATCH v3 2/4] libtraceevent: Add boiler-plate code for cpumask types Valentin Schneider
2022-12-13 16:56 ` [PATCH v3 3/4] libtraceevent: Pretty-print cpumask fields as a cpulist Valentin Schneider
2022-12-13 16:56 ` [PATCH v3 4/4] libtraceevent: Add unit tests for cpumask processing Valentin Schneider
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221213165620.1034287-2-vschneid@redhat.com \
--to=vschneid@redhat.com \
--cc=bristot@redhat.com \
--cc=douglas.raillard@arm.com \
--cc=linux-trace-devel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=williams@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).