mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Mark Brown <broonie@kernel.org>,
	Menglong Dong <menglong8.dong@gmail.com>,
	Thorsten Blum <thorsten.blum@linux.dev>,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH] tracing: wprobe: Fix to use IS_ERR_PCPU() for per-cpu pointer
Date: Tue, 7 Oct 2025 09:35:10 +0900	[thread overview]
Message-ID: <20251007093510.bbc8b59c21195973e740ea7a@kernel.org> (raw)
In-Reply-To: <CAHk-=whv_JYJCh48wj7vOZmAB2aLdeCXQQHeKqZKuS1+Dunbhg@mail.gmail.com>

On Mon, 6 Oct 2025 11:06:31 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Mon, 6 Oct 2025 at 02:47, Masami Hiramatsu (Google)
> <mhiramat@kernel.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@kernel.org>

      reply	other threads:[~2025-10-07  0:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-06  9:47 Masami Hiramatsu (Google)
2025-10-06 18:06 ` Linus Torvalds
2025-10-07  0:35   ` Masami Hiramatsu [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=20251007093510.bbc8b59c21195973e740ea7a@kernel.org \
    --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

Powered by JetHome