[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <806d3538bf542f23b9b89c35199996f195e82b2cdde50c40ca8478cbbe6af3fb@mail.kernel.org>
Date: Fri, 23 Jan 2026 09:18:57 +0000 (UTC)
From: bot+bpf-ci@...nel.org
To: hui.zhu@...ux.dev,akpm@...ux-foundation.org,hannes@...xchg.org,mhocko@...nel.org,roman.gushchin@...ux.dev,shakeel.butt@...ux.dev,muchun.song@...ux.dev,ast@...nel.org,daniel@...earbox.net,andrii@...nel.org,martin.lau@...ux.dev,eddyz87@...il.com,song@...nel.org,yonghong.song@...ux.dev,john.fastabend@...il.com,kpsingh@...nel.org,sdf@...ichev.me,haoluo@...gle.com,jolsa@...nel.org,shuah@...nel.org,peterz@...radead.org,ojeda@...nel.org,nathan@...nel.org,kees@...nel.org,tj@...nel.org,jeffxu@...omium.org,mkoutny@...e.com,kernel@...rr.cc,brauner@...nel.org,rdunlap@...radead.org,brgerst@...il.com,masahiroy@...nel.org,davem@...emloft.net,kuba@...nel.org,hawk@...nel.org,inwardvessel@...il.com,willemb@...gle.com,kerneljasonxing@...il.com,paul.chaignon@...il.com,a.s.protopopov@...il.com,ameryhung@...il.com,chenridong@...weicloud.com,lance.yang@...ux.dev,jiayuan.chen@...ux.dev,linux-kernel@...r.kernel.org,linux-mm@...ck.org,cgroups@...r.kernel.org,bpf@...r.kernel.org,netdev@...r.kernel.org,linu
x-kselftest@...r.kernel.org
Cc: zhuhui@...inos.cn,geliang@...nel.org,ast@...nel.org,andrii@...nel.org,daniel@...earbox.net,martin.lau@...nel.org,eddyz87@...il.com,yonghong.song@...ux.dev,clm@...a.com,ihor.solodrai@...ux.dev
Subject: Re: [RFC PATCH bpf-next v3 11/12] selftests/bpf: Add test for memcg_bpf_ops hierarchies
> diff --git a/tools/testing/selftests/bpf/prog_tests/memcg_ops.c b/tools/testing/selftests/bpf/prog_tests/memcg_ops.c
> index 9a8d16296f2d..bab9f3094f59 100644
> --- a/tools/testing/selftests/bpf/prog_tests/memcg_ops.c
> +++ b/tools/testing/selftests/bpf/prog_tests/memcg_ops.c
[ ... ]
> +void test_memcg_ops_hierarchies(void)
> +{
> + int ret, first = -1, second = -1, third = -1;
> + struct memcg_ops *skel;
> + struct bpf_map *map;
> + struct bpf_link *link1 = NULL, *link2 = NULL, *link3 = NULL;
[ ... ]
> + opts.relative_fd = second;
> + opts.flags = 0;
> + link2 = bpf_map__attach_struct_ops_opts(map, &opts);
> + if (!ASSERT_OK_PTR(link2, "bpf_map__attach_struct_ops_opts"))
> + goto cleanup;
> +
> + opts.relative_fd = third;
> + opts.flags = 0;
> + link2 = bpf_map__attach_struct_ops_opts(map, &opts);
> + if (!ASSERT_ERR_PTR(link3, "bpf_map__attach_struct_ops_opts"))
^^^^^
The result of the third bpf_map__attach_struct_ops_opts() call is stored in
link2, but the assertion checks link3. Since link3 is initialized to NULL
and never modified, the ASSERT_ERR_PTR check does not validate the actual
return value of the third attachment.
Should this be assigning to link3 instead of link2?
> + goto cleanup;
> +
> +cleanup:
> + bpf_link__destroy(link1);
> + bpf_link__destroy(link2);
If the fix is to use link3 for the third attachment result, should
bpf_link__destroy(link3) be added here as well?
> + memcg_ops__detach(skel);
> + close(first);
> + close(second);
> + close(third);
> + cleanup_cgroup_environment();
> +}
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21280790825
Powered by blists - more mailing lists