linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH perf/core] uprobes: fix WARN() inside hprobe_consume()
@ 2024-10-30 16:02 Andrii Nakryiko
  2024-10-30 20:12 ` Peter Zijlstra
  0 siblings, 1 reply; 2+ messages in thread
From: Andrii Nakryiko @ 2024-10-30 16:02 UTC (permalink / raw)
  To: linux-trace-kernel, peterz, oleg
  Cc: rostedt, mhiramat, mingo, bpf, linux-kernel, jolsa, paulmck,
	Andrii Nakryiko, kernel test robot, Dan Carpenter

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH perf/core] uprobes: fix WARN() inside hprobe_consume()
  2024-10-30 16:02 [PATCH perf/core] uprobes: fix WARN() inside hprobe_consume() Andrii Nakryiko
@ 2024-10-30 20:12 ` Peter Zijlstra
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Zijlstra @ 2024-10-30 20:12 UTC (permalink / raw)
  To: Andrii Nakryiko
  Cc: linux-trace-kernel, oleg, rostedt, mhiramat, mingo, bpf,
	linux-kernel, jolsa, paulmck, kernel test robot, Dan Carpenter

On Wed, Oct 30, 2024 at 09:02:08AM -0700, Andrii Nakryiko wrote:
> 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>

Since I've not yet pushed it out to tip, I've folded it into the original patch.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-10-30 20:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 16:02 [PATCH perf/core] uprobes: fix WARN() inside hprobe_consume() Andrii Nakryiko
2024-10-30 20:12 ` Peter Zijlstra

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).