From: Ian Rogers <irogers@google.com>
To: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
James Clark <james.clark@linaro.org>,
Swapnil Sapkal <swapnil.sapkal@amd.com>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 3/3] perf header: Transition WARN macros to debug.h equivalents
Date: Thu, 10 Sep 2026 14:12:20 -0700 [thread overview]
Message-ID: <20260910211221.3154261-4-irogers@google.com> (raw)
In-Reply-To: <20260910211221.3154261-1-irogers@google.com>
Avoid a checkpatch.pl warning on the use of asm/bug.h by switching the
use of WARN macros to explicit tests and then using pr_warning from
debug.h.
Signed-off-by: Ian Rogers <irogers@google.com>
---
| 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
--git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 0a4236fc0293..c7f2c29f02b0 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -8,7 +8,6 @@
#include <stdlib.h>
#include <string.h>
-#include <asm/bug.h>
#include <byteswap.h>
#include <dirent.h>
#include <linux/bitops.h>
@@ -385,8 +384,10 @@ static int do_read_bitmap(struct feat_fd *ff, unsigned long **pset, u64 *psize)
static int write_tracing_data(struct feat_fd *ff,
struct evlist *evlist __maybe_unused)
{
- if (WARN(ff->buf, "Error: calling %s in pipe-mode.\n", __func__))
+ if (ff->buf) {
+ pr_warning("Error: calling %s in pipe-mode.\n", __func__);
return -1;
+ }
#ifdef HAVE_LIBTRACEEVENT
return read_tracing_data(ff->fd, &evlist__core(evlist)->entries);
@@ -407,8 +408,10 @@ static int write_build_id(struct feat_fd *ff,
if (!perf_session__read_build_ids(session, true))
return -1;
- if (WARN(ff->buf, "Error: calling %s in pipe-mode.\n", __func__))
+ if (ff->buf) {
+ pr_warning("Error: calling %s in pipe-mode.\n", __func__);
return -1;
+ }
err = perf_session__write_buildid_table(session, ff);
if (err < 0) {
@@ -1014,8 +1017,10 @@ static int write_auxtrace(struct feat_fd *ff,
struct perf_session *session;
int err;
- if (WARN(ff->buf, "Error: calling %s in pipe-mode.\n", __func__))
+ if (ff->buf) {
+ pr_warning("Error: calling %s in pipe-mode.\n", __func__);
return -1;
+ }
session = container_of(ff->ph, struct perf_session, header);
@@ -1109,9 +1114,10 @@ static int write_dir_format(struct feat_fd *ff,
session = container_of(ff->ph, struct perf_session, header);
data = session->data;
- if (WARN_ON(!perf_data__is_dir(data)))
+ if (!perf_data__is_dir(data)) {
+ pr_warning("Expected data to be a directory\n");
return -1;
-
+ }
return do_write(ff, &data->dir.version, sizeof(data->dir.version));
}
@@ -3715,9 +3721,10 @@ static int process_dir_format(struct feat_fd *ff,
session = container_of(ff->ph, struct perf_session, header);
data = session->data;
- if (WARN_ON(!perf_data__is_dir(data)))
+ if (!perf_data__is_dir(data)) {
+ pr_warning("Expected data to be a directory\n");
return -1;
-
+ }
return do_read_u64(ff, &data->dir.version);
}
@@ -4395,8 +4402,10 @@ static int do_write_feat(struct feat_fd *ff, int type,
if (!feat_ops[type].write)
return -1;
- if (WARN(ff->buf, "Error: calling %s in pipe-mode.\n", __func__))
+ if (ff->buf) {
+ pr_warning("Error: calling %s in pipe-mode.\n", __func__);
return -1;
+ }
(*p)->offset = lseek(ff->fd, 0, SEEK_CUR);
--
2.55.0.1007.g17ff1f9808-goog
prev parent reply other threads:[~2026-09-10 21:12 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 17:37 [PATCH v1 1/3] perf header: Fix HEADER_COMPRESSED validation for comp_mmap_len Ian Rogers
2026-09-10 17:37 ` [PATCH v1 2/3] perf header: Fix potential memory corruption in cpu_cache_level__read Ian Rogers
2026-09-10 17:37 ` [PATCH v1 3/3] perf header: Transition WARN macros to debug.h equivalents Ian Rogers
2026-09-10 17:56 ` [PATCH v2 1/3] perf test x86: Fix missing __msan_unpoison Ian Rogers
2026-09-10 17:56 ` [PATCH v2 2/3] perf header: Fix HEADER_COMPRESSED validation for comp_mmap_len Ian Rogers
2026-09-10 17:56 ` [PATCH v2 3/3] perf header: Fix potential memory corruption in cpu_cache_level__read Ian Rogers
2026-09-10 21:12 ` [PATCH v3 0/3] perf header: Fix memory corruption and unnecessary warning Ian Rogers
2026-09-10 21:12 ` [PATCH v3 1/3] perf header: Fix HEADER_COMPRESSED validation for comp_mmap_len Ian Rogers
2026-09-10 21:12 ` [PATCH v3 2/3] perf header: Fix potential memory corruption in cpu_cache_level__read Ian Rogers
2026-09-10 21:12 ` Ian Rogers [this message]
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=20260910211221.3154261-4-irogers@google.com \
--to=irogers@google.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=james.clark@linaro.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=swapnil.sapkal@amd.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
all inboxes | Powered by JetHome®