Thread (9 messages) flat view 9 messages, 7 authors, 2020-02-22

Re: [PATCH bpf-next] selftests/bpf: fix trampoline_count clean up logic

From: Song Liu <song@kernel.org>
Date: 2020-02-21 02:06:42
Also in: bpf

On Thu, Feb 20, 2020 at 3:07 PM Andrii Nakryiko [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Libbpf's Travis CI tests caught this issue. Ensure bpf_link and bpf_object
clean up is performed correctly.

Fixes: d633d57902a5 ("selftest/bpf: Add test for allowed trampolines count")
Cc: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <redacted>
---
 .../bpf/prog_tests/trampoline_count.c         | 25 +++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
index 1f6ccdaed1ac..781c8d11604b 100644
--- a/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
+++ b/tools/testing/selftests/bpf/prog_tests/trampoline_count.c
@@ -55,31 +55,40 @@ void test_trampoline_count(void)
        /* attach 'allowed' 40 trampoline programs */
        for (i = 0; i < MAX_TRAMP_PROGS; i++) {
                obj = bpf_object__open_file(object, NULL);
-               if (CHECK(IS_ERR(obj), "obj_open_file", "err %ld\n", PTR_ERR(obj)))
+               if (CHECK(IS_ERR(obj), "obj_open_file", "err %ld\n", PTR_ERR(obj))) {
+                       obj = NULL;
I think we don't need obj and link in cleanup? Did I miss anything?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help