[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEf4BzZLMkQA3Sb9=Ojpif1UiZo6ecbXCAz7u_Qi7_GEEYfs1A@mail.gmail.com>
Date: Tue, 5 Oct 2021 21:44:50 -0700
From: Andrii Nakryiko <andrii.nakryiko@...il.com>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf <bpf@...r.kernel.org>, Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>,
Networking <netdev@...r.kernel.org>
Subject: Re: [PATCH bpf-next v1 6/6] bpf: selftests: Fix memory leak in test_ima
On Tue, Oct 5, 2021 at 5:29 PM Kumar Kartikeya Dwivedi <memxor@...il.com> wrote:
>
> The allocated ring buffer is never freed, do so in the cleanup path.
>
> Fixes: f446b570ac7e (bpf/selftests: Update the IMA test to use BPF ring buffer)
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@...il.com>
> ---
Please stick to "selftests/bpf: " prefix which we use consistently for
BPF selftests patches.
Other than that LGTM.
Acked-by: Andrii Nakryiko <andrii@...nel.org>
> tools/testing/selftests/bpf/prog_tests/test_ima.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/test_ima.c b/tools/testing/selftests/bpf/prog_tests/test_ima.c
> index 0252f61d611a..97d8a6f84f4a 100644
> --- a/tools/testing/selftests/bpf/prog_tests/test_ima.c
> +++ b/tools/testing/selftests/bpf/prog_tests/test_ima.c
> @@ -43,7 +43,7 @@ static int process_sample(void *ctx, void *data, size_t len)
> void test_test_ima(void)
> {
> char measured_dir_template[] = "/tmp/ima_measuredXXXXXX";
> - struct ring_buffer *ringbuf;
> + struct ring_buffer *ringbuf = NULL;
> const char *measured_dir;
> char cmd[256];
>
> @@ -85,5 +85,6 @@ void test_test_ima(void)
> err = system(cmd);
> CHECK(err, "failed to run command", "%s, errno = %d\n", cmd, errno);
> close_prog:
> + ring_buffer__free(ringbuf);
> ima__destroy(skel);
> }
> --
> 2.33.0
>
Powered by blists - more mailing lists