[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20251007093510.bbc8b59c21195973e740ea7a@kernel.org>
Date: Tue, 7 Oct 2025 09:35:10 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Steven Rostedt <rostedt@...dmis.org>, Mark Brown <broonie@...nel.org>,
Menglong Dong <menglong8.dong@...il.com>, Thorsten Blum
<thorsten.blum@...ux.dev>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing: wprobe: Fix to use IS_ERR_PCPU() for per-cpu
pointer
On Mon, 6 Oct 2025 11:06:31 -0700
Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> On Mon, 6 Oct 2025 at 02:47, Masami Hiramatsu (Google)
> <mhiramat@...nel.org> wrote:
> >
> > tw->bp_event = register_wide_hw_breakpoint(&attr, wprobe_perf_handler, tw);
> > - if (IS_ERR((void * __force)tw->bp_event)) {
> > + if (IS_ERR_PCPU((void * __force)tw->bp_event)) {
> > int ret = PTR_ERR((void * __force)tw->bp_event);
>
> No, this is still entirely wrong.
>
> That casts are *WRONG*. They should not exist. And they will cause
> compiler errors, because you are casting fundamentally different
> pointer types.
Ah, got it!
>
> They don't just point to different types, they aren't even in the same
> address space!
>
> Stop adding random casts. They are a sign of type errors, and as long
> as they are there, the code is buggy.
OK.
>
> And no, it's not just that IS_ERR() that was wrong. That PTR_ERR()
> won't work on a percpu pointer either.
>
> No more of this randomness, please.
OK, let me fix that.
Thank you!
>
> Linus
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists