From: sashiko-bot@kernel.org
To: "Tanushree Shah" <tshah@linux.ibm.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [RFC PATCH v3 3/5] perf data-convert: Add perf.data to trace.dat conversion backend
Date: Mon, 03 Aug 2026 15:11:50 +0000 [thread overview]
Message-ID: <20260803151150.C33031F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803145958.299956-4-tshah@linux.ibm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] Missing inline fallback stub for `trace_convert__perf2dat` when `HAVE_LIBTRACEEVENT` is undefined.
- [Medium] Missing POSIX header `<stdio.h>` for file I/O operations.
- [Medium] Resource leak: orphaned file left on the filesystem if `fdopen()` fails.
--
--- Patch [3]: [RFC PATCH v3 3/5] perf data-convert: Add perf.data to trace.dat conversion backend ---
commit 25ab95b73fc4726a00bca4e0429ad24d8f04129d
Author: Tanushree Shah <tshah@linux.ibm.com>
perf data-convert: Add perf.data to trace.dat conversion backend
Add data-convert-trace.c implementing trace_convert__perf2dat() to
convert perf.data tracepoint events to trace.dat format.
> diff --git a/tools/perf/util/data-convert-trace.c b/tools/perf/util/data-convert-trace.c
> new file mode 100644
> index 0000000000000..8dbdb2c9caa4f
> --- /dev/null
> +++ b/tools/perf/util/data-convert-trace.c
> @@ -0,0 +1,241 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
[ ... ]
> +#include <errno.h>
> +#include <inttypes.h>
> +#include <fcntl.h>
> +#include <string.h>
> +#include <unistd.h>
[Severity: Medium]
Does this file also need to include <stdio.h>?
The code heavily relies on FILE pointers and stdio routines like fopen(),
fdopen(), and fclose(). Without the explicit include, builds might fail on
musl libc due to relying on implicit inclusions.
> +#include <linux/compiler.h>
> +#include <linux/err.h>
[ ... ]
> +int trace_convert__perf2dat(const char *input, const char *to_trace,
> + struct perf_data_convert_opts *opts)
> +{
[ ... ]
> + if (!opts->force) {
> + int fd = open(to_trace, O_WRONLY | O_CREAT | O_EXCL, 0644);
> +
> + if (fd < 0) {
[ ... ]
> + return -errno;
> + }
> + trace_dat_fp = fdopen(fd, "wb");
> + if (!trace_dat_fp) {
> + int err = errno;
> +
> + close(fd);
> + pr_err("Failed to open output file '%s': %s\n",
> + to_trace, strerror(err));
> + return -err;
[Severity: Medium]
Can this error path leave an orphaned file on the filesystem?
By returning directly instead of jumping to the out_close label where
unlink(to_trace) is called, the newly created 0-byte file isn't cleaned up.
This might break subsequent runs without --force since O_EXCL would fail
with EEXIST.
> + }
[ ... ]
> diff --git a/tools/perf/util/data-convert.h b/tools/perf/util/data-convert.h
> index a96240f156712..f041c23252263 100644
> --- a/tools/perf/util/data-convert.h
> +++ b/tools/perf/util/data-convert.h
> @@ -19,4 +19,8 @@ int bt_convert__perf2ctf(const char *input_name, const char *to_ctf,
> int bt_convert__perf2json(const char *input_name, const char *to_ctf,
> struct perf_data_convert_opts *opts);
>
> +#ifdef HAVE_LIBTRACEEVENT
> +int trace_convert__perf2dat(const char *input, const char *to_trace,
> + struct perf_data_convert_opts *opts);
> +#endif /* HAVE_LIBTRACEEVENT */
[Severity: Medium]
Should this declaration include a corresponding #else block with a dummy
inline fallback?
When libtraceevent is disabled, omitting the stub could cause compilation
failures if callers do not wrap their usage in #ifdef blocks.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803145958.299956-1-tshah@linux.ibm.com?part=3
next prev parent reply other threads:[~2026-08-03 15:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-03 14:59 [RFC PATCH v3 0/5] Add perf.data tracepoint events to trace.dat conversion Tanushree Shah
2026-08-03 14:59 ` [RFC PATCH v3 1/5] perf/trace-dat: Add trace.dat export infrastructure Tanushree Shah
2026-08-03 15:14 ` sashiko-bot
2026-08-03 14:59 ` [RFC PATCH v3 2/5] perf/trace-event: Write trace.dat metadata sections during parsing Tanushree Shah
2026-08-03 15:14 ` sashiko-bot
2026-08-03 14:59 ` [RFC PATCH v3 3/5] perf data-convert: Add perf.data to trace.dat conversion backend Tanushree Shah
2026-08-03 15:11 ` sashiko-bot [this message]
2026-08-03 14:59 ` [RFC PATCH v3 4/5] perf data: Add --to-trace-dat option for converting perf.data tracepoint events into trace.dat format Tanushree Shah
2026-08-03 15:13 ` sashiko-bot
2026-08-03 14:59 ` [RFC PATCH v3 5/5] perf test: Add test validating trace.dat generated by 'perf data convert --to-trace-dat' Tanushree Shah
2026-08-03 15:19 ` sashiko-bot
2026-08-06 0:15 ` Ian Rogers
2026-08-06 9:20 ` Tanushree Shah
2026-08-06 0:18 ` [RFC PATCH v3 0/5] Add perf.data tracepoint events to trace.dat conversion Ian Rogers
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=20260803151150.C33031F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tshah@linux.ibm.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