From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Mark Brown <broonie@kernel.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Menglong Dong <menglong8.dong@gmail.com>,
Thorsten Blum <thorsten.blum@linux.dev>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [for-next PATCH v2] tracing: wprobe: Fix to use IS_ERR_PCPU() for per-cpu pointer
Date: Tue, 7 Oct 2025 10:03:12 +0900 [thread overview]
Message-ID: <175979899246.1800846.1725245135731182727.stgit@devnote2> (raw)
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Since wprobe uses IS_ERR() for per-cpu pointer, it failed to build.
/tmp/next/build/kernel/trace/trace_wprobe.c: In function '__register_trace_wprobe':
/tmp/next/build/kernel/trace/trace_wprobe.c:176:20: error: cast to generic address space pointer from disjoint '__seg_gs' address space pointer [-Werror]
176 | if (IS_ERR((void * __force)tw->bp_event)) {
| ^
/tmp/next/build/kernel/trace/trace_wprobe.c:177:35: error: cast to generic address space pointer from disjoint '__seg_gs' address space pointer [-Werror]
177 | int ret = PTR_ERR((void * __force)tw->bp_event);
| ^
Use IS_ERR_PCPU() instead.
Reported-by: Mark Brown <broonie@kernel.org>
Closes: https://lore.kernel.org/all/aN6fTmAjD7-SJsw2@sirena.org.uk/
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
- Confirmed that `make allmodconfig && make` passed on x86_64 and arm64.
Changes in v2:
- Remove unneeded casting.
- Use PTR_ERR_PCPU() too.
---
kernel/trace/trace_wprobe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_wprobe.c b/kernel/trace/trace_wprobe.c
index 4b00a8e917c1..98605b207f43 100644
--- a/kernel/trace/trace_wprobe.c
+++ b/kernel/trace/trace_wprobe.c
@@ -173,8 +173,8 @@ static int __register_trace_wprobe(struct trace_wprobe *tw)
attr.bp_type = tw->type;
tw->bp_event = register_wide_hw_breakpoint(&attr, wprobe_perf_handler, tw);
- if (IS_ERR((void * __force)tw->bp_event)) {
- int ret = PTR_ERR((void * __force)tw->bp_event);
+ if (IS_ERR_PCPU(tw->bp_event)) {
+ int ret = PTR_ERR_PCPU(tw->bp_event);
tw->bp_event = NULL;
return ret;
next reply other threads:[~2025-10-07 1:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 1:03 Masami Hiramatsu (Google) [this message]
2025-10-07 3:12 ` [for-next PATCH v2] tracing: wprobe: Fix to use IS_ERR_PCPU() for per-cpu pointer Menglong Dong
2025-10-07 13:57 ` Masami Hiramatsu
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=175979899246.1800846.1725245135731182727.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=menglong8.dong@gmail.com \
--cc=rostedt@goodmis.org \
--cc=thorsten.blum@linux.dev \
--cc=torvalds@linux-foundation.org \
/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).