public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: linux-trace-kernel@vger.kernel.org, peterz@infradead.org,
	oleg@redhat.com
Cc: rostedt@goodmis.org, mhiramat@kernel.org, mingo@kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	jolsa@kernel.org, paulmck@kernel.org,
	Andrii Nakryiko <andrii@kernel.org>,
	kernel test robot <lkp@intel.com>,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: [PATCH perf/core] uprobes: fix WARN() inside hprobe_consume()
Date: Wed, 30 Oct 2024 09:02:08 -0700	[thread overview]
Message-ID: <20241030160208.2115179-1-andrii@kernel.org> (raw)

Use proper `*hstate` to print unexpected hprobe state. And drop unused
local `state` variable.

Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/r/202410302020.1jHBLfss-lkp@intel.com/
Fixes: 72a27524a493 ("uprobes: SRCU-protect uretprobe lifetime (with timeout)")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 kernel/events/uprobes.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 998a9726b80f..f2beb4b3f5c5 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -704,8 +704,6 @@ static void hprobe_init_stable(struct hprobe *hprobe, struct uprobe *uprobe)
  */
 static inline struct uprobe *hprobe_consume(struct hprobe *hprobe, enum hprobe_state *hstate)
 {
-	enum hprobe_state state;
-
 	*hstate = xchg(&hprobe->state, HPROBE_CONSUMED);
 	switch (*hstate) {
 	case HPROBE_LEASED:
@@ -715,7 +713,7 @@ static inline struct uprobe *hprobe_consume(struct hprobe *hprobe, enum hprobe_s
 	case HPROBE_CONSUMED:	/* uprobe was finalized already, do nothing */
 		return NULL;
 	default:
-		WARN(1, "hprobe invalid state %d", state);
+		WARN(1, "hprobe invalid state %d", *hstate);
 		return NULL;
 	}
 }
-- 
2.43.5


             reply	other threads:[~2024-10-30 16:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-30 16:02 Andrii Nakryiko [this message]
2024-10-30 20:12 ` [PATCH perf/core] uprobes: fix WARN() inside hprobe_consume() Peter Zijlstra

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=20241030160208.2115179-1-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.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