lkml.org 
[lkml]   [2020]   [Jun]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.7 134/274] selftests/bpf: Fix bpf_link leak in ns_current_pid_tgid selftest
    Date
    From: Andrii Nakryiko <andriin@fb.com>

    [ Upstream commit 8d30e80a049ad699264e4a12911e349f93c7279a ]

    If condition is inverted, but it's also just not necessary.

    Fixes: 1c1052e0140a ("tools/testing/selftests/bpf: Add self-tests for new helper bpf_get_ns_current_pid_tgid.")
    Signed-off-by: Andrii Nakryiko <andriin@fb.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Cc: Carlos Neira <cneirabustos@gmail.com>
    Link: https://lore.kernel.org/bpf/20200429012111.277390-11-andriin@fb.com
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c | 5 +----
    1 file changed, 1 insertion(+), 4 deletions(-)

    diff --git a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
    index 542240e16564..e74dc501b27f 100644
    --- a/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
    +++ b/tools/testing/selftests/bpf/prog_tests/ns_current_pid_tgid.c
    @@ -80,9 +80,6 @@ void test_ns_current_pid_tgid(void)
    "User pid/tgid %llu BPF pid/tgid %llu\n", id, bss.pid_tgid))
    goto cleanup;
    cleanup:
    - if (!link) {
    - bpf_link__destroy(link);
    - link = NULL;
    - }
    + bpf_link__destroy(link);
    bpf_object__close(obj);
    }
    --
    2.25.1
    \
     
     \ /
      Last update: 2020-06-09 01:10    [W:3.562 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site