Skip to contentSkip to conversation

tracing: Fix wrong return in kprobe_event_gen_test.c

PATCH In review Anton Gusev 3 participants 3 messages Jan 31, 2023 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Fix wrong return in kprobe_event_gen_test.c

Overwriting the error code with the deletion result may cause the function to return 0 despite encountering an error. Commit b111545d26c0 ("tracing: Remove the useless value assignment in test_create_synth_event()") solves a similar issue by returning the original error code, so this patch does the same.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

---
 kernel/trace/kprobe_event_gen_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/kprobe_event_gen_test.c +2 -2
index c736487fc0e4..e0c420eb0b2b 100644
@@ -146,7 +146,7 @@ static int __init test_gen_kprobe_cmd(void)
 	if (trace_event_file_is_valid(gen_kprobe_test))
 		gen_kprobe_test = NULL;
 	/* We got an error after creating the event, delete it */
-	ret = kprobe_event_delete("gen_kprobe_test");
+	kprobe_event_delete("gen_kprobe_test");
 	goto out;
 }
 
@@ -211,7 +211,7 @@ static int __init test_gen_kretprobe_cmd(void)
 	if (trace_event_file_is_valid(gen_kretprobe_test))
 		gen_kretprobe_test = NULL;
 	/* We got an error after creating the event, delete it */
-	ret = kprobe_event_delete("gen_kretprobe_test");
+	kprobe_event_delete("gen_kretprobe_test");
 	goto out;
 }
 
Signature · 1 line
2.39.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · On Tue, 31 Jan 2023 10:58:18 +0300 Anton Gusev <[email protected]> wrote:

Overwriting the error code with the deletion result may cause the function to return 0 despite encountering an error. Commit b111545d26c0 ("tracing: Remove the useless value assignment in test_create_synth_event()") solves a similar issue by returning the original error code, so this patch does the same.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Thanks Anton!

-- Steve

maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Anton Gusev
Quoted 9 lines · On Tue, 31 Jan 2023 10:58:18 +0300 Anton Gusev <[email protected]> wrote:

Overwriting the error code with the deletion result may cause the function to return 0 despite encountering an error. Commit b111545d26c0 ("tracing: Remove the useless value assignment in test_create_synth_event()") solves a similar issue by returning the original error code, so this patch does the same.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Oops, thanks for the fix!

Quoted 29 lines
---
 kernel/trace/kprobe_event_gen_test.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/trace/kprobe_event_gen_test.c +2 -2
index c736487fc0e4..e0c420eb0b2b 100644
@@ -146,7 +146,7 @@ static int __init test_gen_kprobe_cmd(void)
 	if (trace_event_file_is_valid(gen_kprobe_test))
 		gen_kprobe_test = NULL;
 	/* We got an error after creating the event, delete it */
-	ret = kprobe_event_delete("gen_kprobe_test");
+	kprobe_event_delete("gen_kprobe_test");
 	goto out;
 }
 
@@ -211,7 +211,7 @@ static int __init test_gen_kretprobe_cmd(void)
 	if (trace_event_file_is_valid(gen_kretprobe_test))
 		gen_kretprobe_test = NULL;
 	/* We got an error after creating the event, delete it */
-	ret = kprobe_event_delete("gen_kretprobe_test");
+	kprobe_event_delete("gen_kretprobe_test");
 	goto out;
 }
 
Signature · 1 line
2.39.1
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>