mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
selftests/bpf: Correct the check of join cgroup
Use ASSERT_OK_FD to check the return value of join cgroup, or else this test will pass even if the fd < 0. ASSERT_OK_FD can print the error message to the console. Suggested-by: Martin KaFai Lau <martin.lau@kernel.org> Signed-off-by: Jason Xing <kerneljasonxing@gmail.com> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Acked-by: Hou Tao <houtao1@huawei.com> Link: https://lore.kernel.org/all/6d62bd77-6733-40c7-b240-a1aeff55566c@linux.dev/ Link: https://patch.msgid.link/20250204051154.57655-1-kerneljasonxing@gmail.com
This commit is contained in:
committed by
Martin KaFai Lau
parent
0abff462d8
commit
003be25ab9
@@ -202,7 +202,7 @@ err_out:
|
||||
void test_setget_sockopt(void)
|
||||
{
|
||||
cg_fd = test__join_cgroup(CG_NAME);
|
||||
if (cg_fd < 0)
|
||||
if (!ASSERT_OK_FD(cg_fd, "join cgroup"))
|
||||
return;
|
||||
|
||||
if (create_netns())
|
||||
|
||||
Reference in New Issue
Block a user