From: Martin KaFai Lau <martin.lau@linux.dev>
To: Xu Kuohai <xukuohai@huaweicloud.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>, Song Liu <song@kernel.org>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, Mykola Lysenko <mykolal@fb.com>,
Shuah Khan <shuah@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Jesper Dangaard Brouer <hawk@kernel.org>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Alan Maguire <alan.maguire@oracle.com>,
Delyan Kratunov <delyank@fb.com>,
Lorenzo Bianconi <lorenzo@kernel.org>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH bpf-next v4 6/6] selftest/bpf: Fix error usage of ASSERT_OK in xdp_adjust_tail.c
Date: Wed, 12 Oct 2022 16:26:05 -0700 [thread overview]
Message-ID: <33d17f23-03cb-9bff-2e50-06ab0f597640@linux.dev> (raw)
In-Reply-To: <20221011120108.782373-7-xukuohai@huaweicloud.com>
On 10/11/22 5:01 AM, Xu Kuohai wrote:
> From: Xu Kuohai <xukuohai@huawei.com>
>
> xdp_adjust_tail.c calls ASSERT_OK() to check the return value of
> bpf_prog_test_load(), but the condition is not correct. Fix it.
>
> Fixes: 791cad025051 ("bpf: selftests: Get rid of CHECK macro in xdp_adjust_tail.c")
> Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
> ---
> tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c b/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
> index 009ee37607df..39973ea1ce43 100644
> --- a/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
> +++ b/tools/testing/selftests/bpf/prog_tests/xdp_adjust_tail.c
> @@ -18,7 +18,7 @@ static void test_xdp_adjust_tail_shrink(void)
> );
>
> err = bpf_prog_test_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
> - if (ASSERT_OK(err, "test_xdp_adjust_tail_shrink"))
> + if (!ASSERT_OK(err, "test_xdp_adjust_tail_shrink"))
> return;
>
> err = bpf_prog_test_run_opts(prog_fd, &topts);
> @@ -53,7 +53,7 @@ static void test_xdp_adjust_tail_grow(void)
> );
>
> err = bpf_prog_test_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
> - if (ASSERT_OK(err, "test_xdp_adjust_tail_grow"))
> + if (!ASSERT_OK(err, "test_xdp_adjust_tail_grow"))
Ouch... ic. It is why this test has been passing.
> return;
>
> err = bpf_prog_test_run_opts(prog_fd, &topts);
> @@ -90,7 +90,7 @@ static void test_xdp_adjust_tail_grow2(void)
> );
>
> err = bpf_prog_test_load(file, BPF_PROG_TYPE_XDP, &obj, &prog_fd);
> - if (ASSERT_OK(err, "test_xdp_adjust_tail_grow"))
> + if (!ASSERT_OK(err, "test_xdp_adjust_tail_grow"))
> return;
>
> /* Test case-64 */
next prev parent reply other threads:[~2022-10-12 23:26 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-11 12:01 [PATCH bpf-next v4 0/6] Fix bugs found by ASAN when running selftests Xu Kuohai
2022-10-11 12:01 ` [PATCH bpf-next v4 1/6] libbpf: Fix use-after-free in btf_dump_name_dups Xu Kuohai
2022-10-11 12:01 ` [PATCH bpf-next v4 2/6] libbpf: Fix memory leak in parse_usdt_arg() Xu Kuohai
2022-10-13 15:47 ` Andrii Nakryiko
2022-10-14 1:53 ` Xu Kuohai
2022-10-11 12:01 ` [PATCH bpf-next v4 3/6] selftests/bpf: Fix memory leak caused by not destroying skeleton Xu Kuohai
2022-10-11 12:01 ` [PATCH bpf-next v4 4/6] selftest/bpf: Fix memory leak in kprobe_multi_test Xu Kuohai
2022-10-11 12:01 ` [PATCH bpf-next v4 5/6] selftests/bpf: Fix error failure of case test_xdp_adjust_tail_grow Xu Kuohai
2022-10-12 23:17 ` Martin KaFai Lau
2022-10-13 1:45 ` Xu Kuohai
2022-10-11 12:01 ` [PATCH bpf-next v4 6/6] selftest/bpf: Fix error usage of ASSERT_OK in xdp_adjust_tail.c Xu Kuohai
2022-10-12 23:26 ` Martin KaFai Lau [this message]
2022-10-13 1:36 ` Xu Kuohai
2022-10-12 23:41 ` [PATCH bpf-next v4 0/6] Fix bugs found by ASAN when running selftests Martin KaFai Lau
2022-10-13 15:50 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=33d17f23-03cb-9bff-2e50-06ab0f597640@linux.dev \
--to=martin.lau@linux.dev \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=delyank@fb.com \
--cc=haoluo@google.com \
--cc=hawk@kernel.org \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=memxor@gmail.com \
--cc=mykolal@fb.com \
--cc=netdev@vger.kernel.org \
--cc=sdf@google.com \
--cc=shuah@kernel.org \
--cc=song@kernel.org \
--cc=xukuohai@huaweicloud.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox