[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44ac0073-0414-5e06-17c8-8568e3b3107e@fb.com>
Date: Thu, 28 Feb 2019 18:19:24 +0000
From: Yonghong Song <yhs@...com>
To: Andrii Nakryiko <andriin@...com>,
"andrii.nakryiko@...il.com" <andrii.nakryiko@...il.com>,
Kernel Team <Kernel-team@...com>,
"Alexei Starovoitov" <ast@...com>,
"acme@...nel.org" <acme@...nel.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"bpf@...r.kernel.org" <bpf@...r.kernel.org>,
"daniel@...earbox.net" <daniel@...earbox.net>
Subject: Re: [PATCH bpf-next 1/5] selftests/bpf: fix btf_dedup testing code
On 2/27/19 2:46 PM, Andrii Nakryiko wrote:
> btf_dedup testing code doesn't account for length of struct btf_header
> when calculating the start of a string section. This patch fixes this
> problem.
>
> Fixes: 49b57e0d01db ("tools/bpf: remove btf__get_strings() superseded by raw data API")
> Signed-off-by: Andrii Nakryiko <andriin@...com>
Acked-by: Yonghong Song <yhs@...com>
for Patch #1 - #3.
> ---
> tools/testing/selftests/bpf/.gitignore | 1 +
> tools/testing/selftests/bpf/test_btf.c | 4 ++--
> 2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/.gitignore b/tools/testing/selftests/bpf/.gitignore
> index e47168d1257d..3b74d23fffab 100644
> --- a/tools/testing/selftests/bpf/.gitignore
> +++ b/tools/testing/selftests/bpf/.gitignore
> @@ -14,6 +14,7 @@ feature
> test_libbpf_open
> test_sock
> test_sock_addr
> +test_sock_fields
> urandom_read
> test_btf
> test_sockmap
> diff --git a/tools/testing/selftests/bpf/test_btf.c b/tools/testing/selftests/bpf/test_btf.c
> index 02d314383a9c..1426c0a905c8 100644
> --- a/tools/testing/selftests/bpf/test_btf.c
> +++ b/tools/testing/selftests/bpf/test_btf.c
> @@ -5936,9 +5936,9 @@ static int do_test_dedup(unsigned int test_num)
> }
>
> test_hdr = test_btf_data;
> - test_strs = test_btf_data + test_hdr->str_off;
> + test_strs = test_btf_data + sizeof(*test_hdr) + test_hdr->str_off;
> expect_hdr = expect_btf_data;
> - expect_strs = expect_btf_data + expect_hdr->str_off;
> + expect_strs = expect_btf_data + sizeof(*test_hdr) + expect_hdr->str_off;
> if (CHECK(test_hdr->str_len != expect_hdr->str_len,
> "test_hdr->str_len:%u != expect_hdr->str_len:%u",
> test_hdr->str_len, expect_hdr->str_len)) {
>
Powered by blists - more mailing lists