Skip to contentSkip to conversation

libbpf: Fix error message in attach_kprobe_session

PATCH Applied Jiri Olsa 2 participants 3 messages May 2, 2024

Subsystems (2)
lore
Share & tools
lore

Jiri Olsa

author reviewer
#0 lore raw

PATCH 1/2 libbpf: Fix error message in attach_kprobe_session

We just failed to retrieve pattern, so we need to print spec instead.

Fixes 2ca178f02b2f ("libbpf: Add support for kprobe session attach")
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index 4ffc8873d1ad..68c87aed8335 100644
@@ -11605,7 +11605,7 @@ static int attach_kprobe_session(const struct bpf_program *prog, long cookie,
 	spec = prog->sec_name + sizeof("kprobe.session/") - 1;
 	n = sscanf(spec, "%m[a-zA-Z0-9_.*?]", &pattern);
 	if (n < 1) {
-		pr_warn("kprobe session pattern is invalid: %s\n", pattern);
+		pr_warn("kprobe session pattern is invalid: %s\n", spec);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.44.0
author reviewer
#1 lore raw

PATCH 2/2 libbpf: Fix error message in attach_kprobe_multi

We just failed to retrieve pattern, so we need to print spec instead.

Fixes ddc6b04989eb ("libbpf: Add bpf_program__attach_kprobe_multi_opts function")
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/lib/bpf/libbpf.c +1 -1
index 68c87aed8335..a3566a456bc8 100644
@@ -11579,7 +11579,7 @@ static int attach_kprobe_multi(const struct bpf_program *prog, long cookie, stru
 
 	n = sscanf(spec, "%m[a-zA-Z0-9_.*?]", &pattern);
 	if (n < 1) {
-		pr_warn("kprobe multi pattern is invalid: %s\n", pattern);
+		pr_warn("kprobe multi pattern is invalid: %s\n", spec);
 		return -EINVAL;
 	}
 
Signature · 1 line
2.44.0
#2 lore raw
In reply to Jiri Olsa
This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Hello:

This series was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:

Quoted 8 lines · On Thu, 2 May 2024 09:55:40 +0200 you wrote:

We just failed to retrieve pattern, so we need to print spec instead.

Fixes 2ca178f02b2f ("libbpf: Add support for kprobe session attach")
---
 tools/lib/bpf/libbpf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Here is the summary with links:
- [bpf-next,1/2] libbpf: Fix error message in attach_kprobe_session

    https://git.kernel.org/bpf/bpf-next/c/5a3941f84b8f
  - [bpf-next,2/2] libbpf: Fix error message in attach_kprobe_multi
    https://git.kernel.org/bpf/bpf-next/c/7c13ef16e87a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html