[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHk-=whv_JYJCh48wj7vOZmAB2aLdeCXQQHeKqZKuS1+Dunbhg@mail.gmail.com>
Date: Mon, 6 Oct 2025 11:06:31 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: "Masami Hiramatsu (Google)" <mhiramat@...nel.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 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.
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.
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.
Linus
Powered by blists - more mailing lists